Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSFT_AADGroup: Bug in group based licensing #2597

Closed
andreasmarx opened this issue Nov 27, 2022 · 2 comments · Fixed by #2642 or #2667
Closed

MSFT_AADGroup: Bug in group based licensing #2597

andreasmarx opened this issue Nov 27, 2022 · 2 comments · Fixed by #2642 or #2667
Assignees
Labels
Bug Something isn't working Entra ID V1.22.1109.1 Version 1.22.1109.1

Comments

@andreasmarx
Copy link

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)

@andikrueger
Copy link
Collaborator

This should be fixed with the last release: #2574

Could you please run Update-M365DSCModule to make sure, you are using the latest bits.

@andikrueger andikrueger added Bug Something isn't working Entra ID V1.22.1109.1 Version 1.22.1109.1 Pending Information labels Nov 28, 2022
@andreasmarx
Copy link
Author

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.

@NikCharlebois NikCharlebois self-assigned this Dec 8, 2022
NikCharlebois added a commit to NikCharlebois/Microsoft365DSC that referenced this issue Dec 8, 2022
NikCharlebois added a commit to NikCharlebois/Microsoft365DSC that referenced this issue Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Entra ID V1.22.1109.1 Version 1.22.1109.1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants