You can only bulk assign licenses for up to 100 users in the GUI interface of Microsoft 365 admin center. You apply to 100 users at a time or the workaround is to use PowerShell
1. Create a security group for the users for each user group
2. Get Object ID for the group by running below mentioned Powershell commands
Install-Module -Name MSOnline
Connect-MSOLService
- Type O365 Admin Creds at the prompt
Get-Msolgroup
- Copy the ObjectID for the group
3. We’ll need our license information, obtain this via:
Get-MSOLAccountSKU
- Record the appropriate SKU name for the license you want to assign, e.g. “Contoso:POWER_BI_STANDARD”
SPE_E5 for Microsoft 365 E5
SPE_F1 for Microsoft 365 F1
Here is the article to get correct license names:
Product names and service plan identifiers for licensing - Azure AD | Microsoft Docs
4. Run the following for a bulk assignment:
Get-MsolGroupMember -GroupObjectId 74d7b44e-6811-4250-bffe-8292e3b0b689 -All | foreach {Set-MsolUser -Objectid $_.objectid -UsageLocation "US"; Set-MsolUserLicense -Objectid $_.objectid -AddLicenses "Contoso:POWER_BI_STANDARD"}
- Please note: Replace 74d7b44e-6811-4250-bffe-8292e3b0b689 with the ObjectID for your security group in the above mentioned command.
- Please note: Replace Contoso:POWER_BI_STANDARD with the appropriate SKU name
In order to bulk remove the license just modify the script in step 4 in following manner and change parameter "-AddLicenses" to "-RemoveLicenses":
Get-MsolGroupMember -GroupObjectId 74d7b44e-6811-4250-bffe-8292e3b0b689 -All | foreach {Set-MsolUser -Objectid $_.objectid -UsageLocation "US"; Set-MsolUserLicense -Objectid $_.objectid -RemoveLicenses "Contoso:POWER_BI_STANDARD"}
Remove Apps from Office 365 License:
To remove Apps from License you would need to use following:
(Get-MsolAccountSku | where {$_.AccountSkuId -eq "<AccountSkuId>"}).ServiceStatus
Replace AccountSkuID with the license that you want to remove Apps from. (Screenshot below)
Now you got the ServicePlan list included in that license, please note down the service plan name which you want to remove.
Now type in following:
$LO = New-MsolLicenseOptions -AccountSkuId <AccountSkuId> -DisabledPlans "<UndesirableService1>"
Replace AccountSkuID with the license that you have assigned to the group and replace <UndesirableService1> with app service plan name that you noted earlier and just type in following command:
Get-MsolGroupMember -GroupObjectId 118fc6a6-c8c2-45bc-900e-8cabb9fcc5ef -All | foreach {Set-MsolUser -Objectid $_.objectid -UsageLocation "US"; Set-MsolUserLicense -Objectid $_.objectid -LicenseOptions $LO -ErrorAction SilentlyContinue}
Please make sure to change the -GroupObjectID to your group ID from which you would like to remove license service plan from.
Reference:
- Product names and service plan identifiers for licensing - Azure AD | Microsoft Docs
- https://docs.microsoft.com/en-us/microsoft-365/enterprise/disable-access-to-services-with-microsoft-365-powershell?view=o365-worldwide#disable-specific-microsoft-365-services-for-specific-users-for-a-specific-licensing-plan
- Assign Microsoft 365 licenses to user accounts with PowerShell - Microsoft 365 Enterprise | Microsoft Docs
Comments
0 comments
Please sign in to leave a comment.