Purchase O365 O365_BUSINESS_PREMIUM/ESSENTIALS Licences using Powershell

Copper Contributor

Hello experts,


i created a ps-skript for creating new users in our organization. I use this command for adding existend licenses:


New-MsolUser -DisplayName $FullName -FirstName $Name -LastName $Surname -UserPrincipalName $FitnessloftUser -UsageLocation DE -LicenseAssignment fitloft:O365_BUSINESS_ESSENTIALS


When they are no more licenses available it is obviously not possible to add the license, so i have to buy the licenses in the O365 Admin Panel manually. I want to add a condition which should buy a license automatically when they are no license available. I searched a lot and most of the answers were that this is not possible through Powershell. Maybe someone tried it before and can tell if this is possible or not.

Thank your very much.


4 Replies
I don't think there is any option for that using PowerShell, if you have a license provider with a portal.. Perhaps they have an API interface or something that you could use?
Did you find a solution for this?

no unfortunately not. I think it is not possible via powershell script.

Too bad, would have been nice. We can only check the possibilites which Microsoft will give us for automating things