It is possible to use the Office 365 PowerShell Modules with CloudM Migrate.
Step-by-step guide
Install the Microsoft Online Services Sign-in Assistant and PowerShell Module available from: Manage Windows Azure Active Directory by using Windows PowerShell
It can take some time before a mailbox is fully allocated after called New-MsolUser and until the mailbox exists, migrations will fail with "InvalidUser". Using the default scripts, which call New-Mailbox usually allows migration to commence immediately after running the script.
When these have been installed the PowerShell scripts within the CloudM Migrate need to be edited to use the newly available MSOnline cmdlets.
Edit the ‘PowerShell Init Script’ to be as follows. This script opens a connection to the Office 365 servers.
# Set this so that errors are thrown from Cmdlets $ErrorActionPreference = 'Stop' # Import the Office 365 Module Import-Module MSOnline # Open the connection Connect-MsolService -credential (New-Object -TypeName System.Management.Automation.PSCredential -argumentlist '[!admin-email]',(ConvertTo-SecureString '[!admin-password]' -AsPlainText -Force))
Edit the ‘PowerShell Before Script’ to be as follows. This script checks a user exists and creates one with the provided details if not. Note the script below sets the ‘Usage Location’ to be the US – change this if required.
# Set this so that errors are thrown from Cmdlets $ErrorActionPreference = 'Stop' # Check if a user exists Function UserExists() { trap { return $false } Get-MsolUser -UserPrincipalName '[!user-importname]@[!admin-domain]' return $true; } # Create a user if it doesn't exist Function CreateUser() { $ret = UserExists if ($ret -eq $false) { New-MsolUser -UserPrincipalName '[!user-importname]@[!admin-domain]' -DisplayName '[!user-givenname] [!user-familyname]' -FirstName '[!user-givenname]' -LastName '[!user-familyname]' -UsageLocation US -Password '[!user-password]' Start-Sleep 30; } } CreateUser
Restrictions
It is currently possible to use the Office 365 PowerShell Modules with CloudM Migrate only on 32 bit workstations. Due to way CloudM Migrate works with some of the source systems that it supports, it must run as a 32bit process, even when running on 64bit versions of Windows.
When running a 64 bit version of Windows only the 64 bit version of the Office 365 PowerShell Modules can be installed. When attempting to use the 64 bit version of the Office 365 PowerShell Modules from CloudM Migrate the MSOnline Module cannot be loaded due to the difference in architecture and the cmdlets cannot be used.
To workaround this issue, use the default PowerShell scripts included with the tool which makes use only of cmdlets available on the Office 365 servers and is not dependent on the architecture of the migration workstation. The restriction on using the Office 365 PowerShell Modules only with 32 bit hosts will be removed in a future version of the CloudM Migrate.