Tip #828: Quickly migrate existing CRM Online licenses to Dynamics 365 licenses using PowerShell

I was not aware that Gayan “Performance Wizard” Perera shares my affection for PowerShell. Until this quick tip on how to bulk migrate CRM Online licenses to Dynamics 365 licenses using PowerShell.

$credentials = Get-Credential
Connect-MsolService -Credential $credentials
# this will get you a list of license types along with the tenant name which we'll be using later
Get-MsolAccountSku | Format-Table AccountSkuId, SkuPartNumber

# need to create a custom plan and remove sharepoint and project essentials. these are already assinged by Office E* plans
$myplan = New-MsolLicenseOptions -AccountSkuId "tenant:DYN365_ENTERPRISE_TEAM_MEMBERS" -DisabledPlans SHAREPOINTENTERPRISE,SHAREPOINTWAC,PROJECT_ESSENTIALS

# get a list of users using Get-MsolUser and foreach loop; https://support.microsoft.com/en-nz/help/2777380/getting-all-licensed-office-365-users-with-powershell

# "tenant" is the name from the Get-MsolAccountSku command above
Set-MsolUserLicense -UserPrincipalName "user@user.com" -AddLicenses "tenant:DYN365_ENTERPRISE_TEAM_MEMBERS" -LicenseOptions $myplan

# remove the existing license, ensure you're removing the correct old license. i.e. "CRMPLAN2"
Set-MsolUserLicense -UserPrincipalName "user@user.com" -RemoveLicenses "tenant:CRMPLAN2"

Comes in handy when you have to assign the new D365 licenses to hundreds or thousands of users.

Seal of approval

Share on FacebookTweet about this on TwitterShare on Google+

Leave a Reply

Your email address will not be published. Required fields are marked *