This post is about how to assign license to office 365 users via powershell. We will need a csv with the required users.
Open the Windows Azure Active Directory Module and run:
Import-Module MsOnline Connect-MsolService Get-MsolAccountSku <# get the list of the license options #> $license = New-MsolLicenseOptions -AccountSkuId xxxx:XXXXXXXXX_XXXXXXXX <#here we can specify more license options #> Import-Csv C:list.csv | foreach { Get-MsolUser -UserPrincipalName $_.UPN | Set-MsolUser -UsageLocation XX } <# where XX is the country ID #> Import-Csv C:list.csv | foreach { Get-MsolUser -UserPrincipalName $_.UPN | Set-MsolUserLicense -AddLicenses "xxxx:XXXXXXXXX_XXXXXXXX" -LicenseOptions $license }
Pantelis Apostolidis is a Sr. Specialist, Azure at Microsoft and a former Microsoft Azure MVP. For the last 20 years, Pantelis has been involved to major cloud projects in Greece and abroad, helping companies to adopt and deploy cloud technologies, driving business value. He is entitled to a lot of Microsoft Expert Certifications, demonstrating his proven experience in delivering high quality solutions. He is an author, blogger and he is acting as a spokesperson for conferences, workshops and webinars. He is also an active member of several communities as a moderator in azureheads.gr and autoexec.gr. Follow him on Twitter @papostolidis.