I've run the commands in this technet article: https://technet.microsoft.com/en-us/library/mt171421.aspx
Unfrotunately I'm getting this error when I try to run the wizard:
<errorlog><sites>
<site>
<url>https://omnisource.sharepoint.com/sites/crmdev</url>
<exception>The request was aborted: The request was canceled.Access token could not be obtained from: https://accounts.accesscontrol.windows.net/tokens/OAuth/2 for resource: 00000003-0000-0ff1-ce00-000000000000/omnisource.sharepoint.com@c0c098c0-0639-4a17-a7eb-d6f5d49efddb</exception>
<errorcode>-2147088205</errorcode>
<correlation>19d4699d-202e-2000-36cf-19425d087443</correlation>
</site>
</sites></errorlog>
#Install msoidcli_64.msi on CRM front-end
#Install Azure AD module on CRM front-end
#Launch Azure AD module
$msolcred = get-credential
#Login as <globaladmin>@omnisource.onmicrosoft.com
connect-msolservice -credential $msolcred
cd "C:\Program Files\Microsoft Dynamics CRM\tools"
$CertificateScriptWithCommand = “.\CertificateReconfiguration.ps1 -certificateFile C:\Support\omni-cert.pfx -password <password> -updateCrm -certificateType S2STokenIssuer -serviceAccount OMNISOURCE\SRV_CRM2016<asyncservice> -storeFindType FindBySubjectDistinguishedName”
Invoke-Expression -command $CertificateScriptWithCommand
Enable-PSRemoting -force
Import-Module MSOnline -force
Import-Module MSOnlineExtended -force
$STSCertificate = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList C:\Support\omni-cert.pfx, <password>
$PFXCertificateBin = $STSCertificate.GetRawCertData()
$Certificate = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$Certificate.Import(“C:\Support\omni-cert.cer”)
$CERCertificateBin = $Certificate.GetRawCertData()
$CredentialValue = [System.Convert]::ToBase64String($CERCertificateBin)
$RootDomain = “*.omnisourcemarketing.com”
$CRMAppId = "00000007-0000-0000-c000-000000000000"
New-MsolServicePrincipalCredential -AppPrincipalId $CRMAppId -Type asymmetric -Usage Verify -Value $CredentialValue
$CRM = Get-MsolServicePrincipal -AppPrincipalId $CRMAppId
$ServicePrincipalName = $CRM.ServicePrincipalNames
$ServicePrincipalName.Remove("$CRMAppId/$RootDomain")
$ServicePrincipalName.Add("$CRMAppId/$RootDomain")
Set-MsolServicePrincipal -AppPrincipalId $CRMAppId -ServicePrincipalNames $ServicePrincipalName
Add-PSSnapin Microsoft.Crm.PowerShell
$setting = New-Object "Microsoft.Xrm.Sdk.Deployment.ConfigurationEntity"
$setting.LogicalName = "ServerSettings"
$setting.Attributes = New-Object "Microsoft.Xrm.Sdk.Deployment.AttributeCollection"
$attribute1 = New-Object "System.Collections.Generic.KeyValuePair[String, Object]" ("S2SDefaultAuthorizationServerPrincipalId", "00000001-0000-0000-c000-000000000000")
$setting.Attributes.Add($attribute1)
$attribute2 = New-Object "System.Collections.Generic.KeyValuePair[String, Object]" ("S2SDefaultAuthorizationServerMetadataUrl", "accounts.accesscontrol.windows.net/.../1")
$setting.Attributes.Add($attribute2)
Set-CrmAdvancedSetting -Entity $setting
### Gets SharePoint Tenant ID
$CRMContextId = (Get-MsolCompanyInformation).ObjectID
$CRMContextId
------------------------
Am I missing something?