question

TassieTrooper-4773 avatar image
0 Votes"
TassieTrooper-4773 asked azure-cxp-api edited

Assign M365 licence via PowerShell - Set-MsolUserLicense - Invalid

Hi,

I am trying to assign a M365 Business Premium licence via PS using "Set-MsolUserLicense -UserPrincipalName <userPN> -AddLicenses reseller-account:o365_business_premium" however it is failing saying the licence is invalid. I have added the -TenantID parameter also to no avail.

I have used the Get-MsolAccountSku and this is the SKU that is returned. I have tried using just "o365_business_premium" and also prepended our M365 domain instead of "reseller-account", however it still reports as being 'invalid'.

Error:

Set-MsolUserLicense : Unable to assign this license because it is invalid. Use the Get-MsolAccountSku cmdlet to
retrieve a list of valid licenses.
At line:1 char:1
+ Set-MsolUserLicense -UserPrincipalName <userPN> ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [Set-MsolUserLicense], MicrosoftOnlineException
+ FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.InvalidUserLicenseException,Microsoft.Online.
Administration.Automation.SetUserLicense


Anyone have any idea why this is not working?

Cheers!

Dave

not-supported-azure
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@TassieTrooper-4773
I just wanted to check in and see if you required additional assistance or if you were able to resolve this issue?

0 Votes 0 ·

1 Answer

drpollard626 avatar image
1 Vote"
drpollard626 answered drpollard626 edited

I would try this format:

Set-MsolUserLicense -UserPrincipalName "<Account>" -AddLicenses "<AccountSkuId>"

Run the Get command on a licensed user to get the SkuId

Mark as answered if this reply is helpful

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.