How to Bulk Migrate Dynamics CRM Licences to Dynamics 365 Licences using PowerShell

Gayan Perera, 09 February 2017

Along with the rename of Dynamics CRM to Dynamics 365 came new licenses. If you’re on Office 365 with the old Dynamics CRM licenses being assigned to users you will need to re-assign Dynamics 365 licenses to these users at some point.

If you have tens of users then manually removing and assigning the new Dynamics 365 licenses will be just fine. But if you have hundreds or thousands, you probably don’t want to spend a weekend manually doing this. So, here is a little PowerShell script that will do the heavy lifting.

$credentials = Get-Credential
Connect-MsolService -Credential $credentials

Get-MsolAccountSku | Format-Table AccountSkuId, SkuPartNumber


Set-MsolUserLicense -UserPrincipalName "" -AddLicenses "tenant:DYN365_ENTERPRISE_TEAM_MEMBERS" -LicenseOptions $myplan

Set-MsolUserLicense -UserPrincipalName "" -RemoveLicenses "tenant:CRMPLAN2"

The first two lines will ask for credentials of your Office 365 tenant.

Get-MsolAccountSku will list out your current licenses, this is needed to find the exact name of the “tenant” which will be used when adding  and removing the existing Dynamics CRM licenses.

Basically, what’s required is to create a custom plan by removing the SharePoint and Project sub-plans, these are already part of other O365 plans such as E1. If you don’t remove these, the PowerShell command will fail stating that the sub-plans are already assigned to this user.

Once $myplan is configured with the required license, in this example it’s the Dynamics 365 Enterprise Team Member license you can run Set-MsolUserLicense –AddLicenses command.

The last thing to do is to remove the existing Dynamics CRM license. e.g. CRMPLAN2

To run this over multiple users you can foreach loop users from Office 365, this can also be retrieved using PowerShell but I’ll leave that to you to figure out, can’t make it too easy Smile