-
Notifications
You must be signed in to change notification settings - Fork 517
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
The License will get import on the target tenant or not #2556
Comments
Could elaborate a bit more, what this question is about? Thanks! |
I want to import the configuration from source tenant to target tenant in that situation for user the License, user attributes, user member group also will get import or not? |
There won’t be any licenses transferred from your source Tenant to the target tenant. The objects within the tenant depend on what you did export and therefore this will also determine what is going to be created/updated within your target tenant. |
If i exported the Azure AD from source tenant and same thing i am importing into target tenant for user the License, user attributes, user member group will get assign or not. Because when i check the export configuration of source tenant i can see the user License details, user attributes etc., but when i try to import the same configuration in target tenant only the user it's get creating. Can you help me on this. I have attached screenshot for your reference. |
If you do have the same SKUs within your target tenant, M365 would try to assign the licenses to the user. If M365DSC is not able to find any licenses within the target tenant, no license assignment will happen. This is the code, that would look for license: #region Licenses
if ($LicenseAssignment -ne $null)
{
[Array] $currentLicenses = $user.LicenseAssignment
if ($null -eq $currentLicenses)
{
$currentLicenses = @()
}
$licenseDifferences = Compare-Object -ReferenceObject $LicenseAssignment -DifferenceObject $currentLicenses
if ($licensesDifferences.Length -gt 0)
{
$licenses = @{AddLicenses = @(); RemoveLicenses = @();}
$SubscribedSku = Get-MgSubscribedSku
foreach ($licenseSkuPart in $LicenseAssignment)
{
Write-Verbose -Message "Adding License {$licenseSkuPart} to the Queue"
$license = @{
SkuId = ($SubscribedSku | Where-Object -Property SkuPartNumber -Value $licenseSkuPart -EQ).SkuID
}
# Set the Office license as the license we want to add in the $licenses object
$licenses.AddLicenses += $license
}
foreach ($currentLicense in $user.LicenseAssignment)
{
if ($LicenseAssignment -and -not $LicenseAssignment.Contains($currentLicense))
{
Write-Verbose -Message "Removing {$currentLicense} from user {$UserPrincipalName}"
$license = @{
SkuId = ($SubscribedSku | Where-Object -Property SkuPartNumber -Value $currentLicense -EQ).SkuID
}
$licenses.RemoveLicenses += $license
}
}
}
}
#endregion |
I replaced the SKU that is available in target tenant to assign to the user. Exported source configuration screenshot is as below. Modified in MOF file the screenshot is below.(replaced the SKU that existing in target tenant) Still the license is not getting assigned on the target tenant. Also noticed the licensed assignment function is getting pushed before getting the user. (logically it's not possible) Manually i can modify for 1 or 2 users and also can add delay/wait in between creating user and license assignment but what if there are bulk users? |
I just checked the code and the order of the operations is correct. Could you have a look at your event log to see, if something is reported there? The user is created in line 484-501. License assignment will take place in lines 504-535. |
Details of the scenario you tried and the problem that is occurring
Verbose logs showing the problem
Suggested solution to the issue
The DSC configuration that is used to reproduce the issue (as detailed as possible)
# insert configuration here
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: