Simplify user tasks like bulk creation, updates, password resets, deletions, license checks & more — all from one place.
🚀 Launch ToolkitManually assigning multiple licenses to each user in Microsoft 365 can be a time-consuming task, especially in larger organizations. This article addresses that challenge by demonstrating how to assign multiple licenses to both individual users and multiple users using Graph PowerShell automation. The scripts below allow administrators to streamline this process efficiently.
Connect-MgGraph -Scopes User.ReadWrite.All, Organization.Read.All
# Get the SKUs for the licenses you want to assign
$EmsSku = Get-MgSubscribedSku -All | Where-Object { $_.SkuPartNumber -eq 'EMSPREMIUM' }
$FlowSku = Get-MgSubscribedSku -All | Where-Object { $_.SkuPartNumber -eq 'FLOW_FREE' }
# Create an array of licenses to assign
$addLicenses = @(
@{SkuId = $EmsSku.SkuId},
@{SkuId = $FlowSku.SkuId}
)
# Assign the licenses to the user
Set-MgUserLicense -UserId 'user-id-here' -AddLicenses $addLicenses -RemoveLicenses @()
Note: To find available license SkuPartNumber values, run:
Get-MgSubscribedSku | Select-Object SkuId, SkuPartNumber
# Get the SKUs for the licenses you want to assign
$PPSku = Get-MgSubscribedSku -All | Where-Object { $_.SkuPartNumber -eq 'Power_Pages_vTrial_for_Makers' }
$FlowSku = Get-MgSubscribedSku -All | Where-Object { $_.SkuPartNumber -eq 'FLOW_FREE' }
# Create an array of licenses to assign
$addLicenses = @(
@{SkuId = $PPSku.SkuId},
@{SkuId = $FlowSku.SkuId}
)
$csvUsers = Import-Csv "C:\users\testuser\downloads\users.csv"
foreach ($user in $csvUsers) {
Set-MgUserLicense -UserId $user.UserId -AddLicenses $addLicenses -RemoveLicenses @()
}
Make sure your CSV has a header column named UserId, containing either the user UPN or object ID.
Error | Cause | Solution |
Set-MgUserLicense : Request_BadRequest | Invalid or missing SKU ID | Verify SKU ID using Get-MgSubscribedSku |
User not found | Incorrect UPN or user ID in CSV file | Double-check and validate input file |
Insufficient privileges to complete the operation | Missing delegated/admin permissions | Ensure the user has appropriate Graph API permissions |
FlowSku or other SKU returns $null | SKU is not available in your tenant | Use Get-MgSubscribedSku to confirm SKU availability |
Using Microsoft Graph PowerShell, administrators can efficiently assign multiple licenses to users in bulk or individually. This approach minimizes manual efforts and ensures consistent license provisioning across the organization. Whether you're onboarding new users or managing trial subscriptions, the scripts above provide a powerful, reusable framework for licensing automation.
© m365corner.com. All Rights Reserved. Design by HTML Codex