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
Licenses do not get assigned to the group if "Get-M365DSCCombinedLicenses" did not return any existing license.
Verbose logs showing the problem
"You cannot call a method on a null-valued expression"
Suggested solution to the issue
Update "Get-M365DSCCombinedLicenses":
old code:
if ($DesiredLicenses.Length -gt 0)
{
foreach ($license in $DesiredLicenses)
{
if (-not $result.SkuId.Contains($license.SkuId))
{
$result += @{
SkuId = $license.SkuId
DisabledPlans = $license.DisabledPlans
}
}
else
{
#Set the Desired Disabled Plans if the sku is already added to the list
foreach ($item in $result)
{
if ($item.SkuId -eq $license.SkuId)
{
$item.DisabledPlans = $license.DisabledPlans
}
}
}
}
}
new code:
if ($DesiredLicenses.Length -gt 0)
{
foreach ($license in $DesiredLicenses)
{
if ($result.Length -eq 0)
{
$result += @{
SkuId = $license.SkuId
DisabledPlans = $license.DisabledPlans
}
}
else {
if (-not $result.SkuId.Contains($license.SkuId))
{
$result += @{
SkuId = $license.SkuId
DisabledPlans = $license.DisabledPlans
}
}
else
{
#Set the Desired Disabled Plans if the sku is already added to the list
foreach ($item in $result)
{
if ($item.SkuId -eq $license.SkuId)
{
$item.DisabledPlans = $license.DisabledPlans
}
}
}
}
}
}
I tried the new code and it did work.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
N/A
The operating system the target node is running
N/A
Version of the DSC module that was used ('dev' if using current dev branch)
1.22.1109.1 (Resource code did not change in the newer releases)
The text was updated successfully, but these errors were encountered:
Unfortunately not. The issue is within group based licencing which is not related to the msft_aaduser resource. Msft_aadgroup last changed two month ago.
Details of the scenario you tried and the problem that is occurring
Licenses do not get assigned to the group if "Get-M365DSCCombinedLicenses" did not return any existing license.
Verbose logs showing the problem
"You cannot call a method on a null-valued expression"
Suggested solution to the issue
Update "Get-M365DSCCombinedLicenses":
old code:
if ($DesiredLicenses.Length -gt 0)
{
foreach ($license in $DesiredLicenses)
{
if (-not $result.SkuId.Contains($license.SkuId))
{
$result += @{
SkuId = $license.SkuId
DisabledPlans = $license.DisabledPlans
}
}
else
{
#Set the Desired Disabled Plans if the sku is already added to the list
foreach ($item in $result)
{
if ($item.SkuId -eq $license.SkuId)
{
$item.DisabledPlans = $license.DisabledPlans
}
}
}
}
}
new code:
if ($DesiredLicenses.Length -gt 0)
{
foreach ($license in $DesiredLicenses)
{
if ($result.Length -eq 0)
{
$result += @{
SkuId = $license.SkuId
DisabledPlans = $license.DisabledPlans
}
}
else {
if (-not $result.SkuId.Contains($license.SkuId))
{
$result += @{
SkuId = $license.SkuId
DisabledPlans = $license.DisabledPlans
}
}
else
{
#Set the Desired Disabled Plans if the sku is already added to the list
foreach ($item in $result)
{
if ($item.SkuId -eq $license.SkuId)
{
$item.DisabledPlans = $license.DisabledPlans
}
}
}
}
}
}
I tried the new code and it did work.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
N/A
The operating system the target node is running
N/A
Version of the DSC module that was used ('dev' if using current dev branch)
1.22.1109.1 (Resource code did not change in the newer releases)
The text was updated successfully, but these errors were encountered: