You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Details of the scenario you tried and the problem that is occurring
Set-TargetResource will fail when the GroupType property of an AAD group is missing.
Verbose logs showing the problem
Setting configuration of Azure AD Groups
VERBOSE:[[AADMSGroup]xxx] Getting configuration of AzureAD Group
VERBOSE:[[AADMSGroup]xxx] Id was NOT specified
You cannot call a method on a null-valued expression.
At D:\... DscConfiguration.ps1:157 char:2
+ $dscTestResults = Start-DSCConfiguration -UseExisting -wait
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : InvokeMethodOnNull
+ PSComputerName : localhost
Suggested solution to the issue
In Set-TargetResource GroupTypes is being evaluated, but the parameter is not mandatory. Thus, if the parameter is empty (aka missing in the config file), the script will crash.
Suggestion: Make GroupTypes a mandatory parameter for Set-TargetResource.
The line where the code crashes is:
@ $GroupTypes.Contains("Unified")
if ($Ensure -eq 'Present' -and $GroupTypes.Contains("Unified") -and $MailEnabled -eq $false)
{
Write-Verbose -Message "Cannot set mailenabled to false if GroupTypes is set to Unified when creating group."
throw "Cannot set mailenabled to false if GroupTypes is set to Unified when creating a group."
}
The DSC configuration that is used to reproduce the issue (as detailed as possible)
The Group name "SEC_CLOUD_NOT_EXISITNG_GRP" has been used for demo purposes only.
Update coming that will default group types to Unified if no implicit types are specified. This will prevent having to release a breaking change for this.
Details of the scenario you tried and the problem that is occurring
Set-TargetResource will fail when the GroupType property of an AAD group is missing.
Verbose logs showing the problem
Suggested solution to the issue
In Set-TargetResource GroupTypes is being evaluated, but the parameter is not mandatory. Thus, if the parameter is empty (aka missing in the config file), the script will crash.
Suggestion: Make GroupTypes a mandatory parameter for Set-TargetResource.
The line where the code crashes is:
@ $GroupTypes.Contains("Unified")
The DSC configuration that is used to reproduce the issue (as detailed as possible)
The Group name "SEC_CLOUD_NOT_EXISITNG_GRP" has been used for demo purposes only.
The operating system the target node is running
Version of the DSC module that was used ('dev' if using current dev branch)
The text was updated successfully, but these errors were encountered: