xGroupSet - using DependsOn results in compilation error
I am using the resource as follows:
xGroupSet AddgMsaToLocalGroups
{
GroupName = $ADData.gMsaLocalGroups
Ensure = "Present"
MembersToInclude = $GroupManagedServiceAccount
Credential = $DomainAdminCreds
DependsOn = "[Script]CreateGmsaAccount"
}
This results in the following error:
The format of the resource reference '' in the Requires list for resource '[xGroup]Resource0::[xGroupSet]AddgMsaToLocalGroups' is not valid.
A required resource name should be in the format '[<typename>]<name>', with alphanumeric characters, spaces, '_', '-', '.' and '\'.
The error only occurs if DependsOn is set.
I label this as bug and help wanted so someone in the community can debug this.
@johlju @rdavisunr is this still an bug? or is there a work around for that? We are still seeing the issue.
@saiprasanthrajavarapu - I have not tried any versions beyond 8.1.0.0. So, can't confirm myself.
As far as a workaround, I ended up doing something like this:
ForEach($groupName in $ADData.gMsaLocalGroups)
{
xGroup "$($NodeName)-Join-$($groupName.replace(' ', ''))"
{
GroupName = $groupName
Ensure = "Present"
MembersToInclude = $GroupManagedServiceAccount
Credential = $DscDomainAdminCreds
DependsOn = "[Script]InstallGmsaAccount"
}
}
I also just encountered this, and just as rdavisunr discovered, it only seems to be a problem with the "set" versions of the resources. The normal resources works fine. Specifically i had problems around the "xWindowsOptionalFeatureSet" resource.