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

Fixes #2556 #2574

Merged
merged 1 commit into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

# UNRELEASED

* AADUser
* Fixed issue with license assignment
FIXES [#2556](https://github.com/microsoft/Microsoft365DSC/issues/2556)
* IntuneRoledefinition
* Initial Release
* Manage Intune Role definition
Expand Down Expand Up @@ -33,7 +36,7 @@
* Fixed incorrect usage of Write-Information cmdLet
* Fixed typos for permissions in settings.json
FIXES [2553](https://github.com/microsoft/Microsoft365DSC/issues/2553)

# 1.22.1116.1

* AADApplication
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,8 @@ function Set-TargetResource
{
$currentLicenses = @()
}
$licenseDifferences = Compare-Object -ReferenceObject $LicenseAssignment -DifferenceObject $currentLicenses
if ($licensesDifferences.Length -gt 0)
[Array]$licenseDifferences = Compare-Object -ReferenceObject $LicenseAssignment -DifferenceObject $currentLicenses
if ($licenseDifferences.Length -gt 0)
{
$licenses = @{AddLicenses = @(); RemoveLicenses = @();}

Expand Down Expand Up @@ -503,10 +503,10 @@ function Set-TargetResource
#region Assign Licenses
try
{
if ($licensesDifferences.Length -gt 0)
if ($licenseDifferences.Length -gt 0)
{
Write-Verbose -Message "Updating License assignments with values: $(Convert-M365DscHashtableToString -Hashtable $licenses)"
Set-MgUserLicense -UserId $user.Id -AddLicenses $licenses.AddLicenses -RemoveLicenses $licenses.RemoveLicenses
Set-MgUserLicense -UserId $user.UserPrincipalName -AddLicenses $licenses.AddLicenses -RemoveLicenses $licenses.RemoveLicenses
}
}
catch
Expand Down Expand Up @@ -544,9 +544,13 @@ function Set-TargetResource
$currentRoles = @()
}

$diffRoles = Compare-Object -ReferenceObject $Roles -DifferenceObject $currentRoles
Write-Verbose -Message "Current Roles: $($currentRoles -join ',')"
Write-Verbose -Message "Desired Roles: $($Roles -join ',')"
[Array]$diffRoles = Compare-Object -ReferenceObject $Roles -DifferenceObject $currentRoles

if ($diffRoles.Length -gt 0)
{
Write-Verbose -Message "Current Roles: $($currentRoles -join ',')"
Write-Verbose -Message "Desired Roles: $($Roles -join ',')"
}

foreach ($roleDifference in $diffRoles)
{
Expand Down