Bize Ulaşın / Contact Us

CRM Logo

Disabling Dynamics CRM Admin Mode via Powershell

20 / 02 / 2020 by Uncategorized Yorum yok / No Comments

I needed to Disable one of our CRM instances Admin Mode, I hit the Power Platform Admin Pages, it redirected me to Classic Dynamic 365 Administrator Center, clicked “Admin” for the Instance, it redirected me to Power Platform again and I started to get login error after a few browsers redirects between MS sites, it says “We couldn’t sign you in. Please try again.” Probably an authorisation token issue between MS sites.


I directly headed to Powershell, installed XRM Online Management API

Install-Module -Name Microsoft.Xrm.OnlineManagementAPI -RequiredVersion 1.2.0.1

And I used Disable-CrmAdminMode to do this, I’m writing these down to save my time if I will face it again, because finding values for parameters takes more time.

Disable-CrmAdminMode (Microsoft.Xrm.OnlineManagementAPI) | Microsoft Docs

We will run this command

Disable-CrmAdminMode -InstanceId ’94…………………1′ -ApiUrl “https://admin.services.crm4.dynamics.com” -Credential $Cred

So we need your CRM Instance ID, and the ApiURL

The ApiURL here is not your Instance API Url actually this is the Service URL, each CRM Region has it own Service URL so you can find yours from https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/online-management-api/get-started-online-management-api#service-url

The following table lists the service URLs of Online Management API for worldwide Office 365 data centres.

LocationService URL
North Americahttps://admin.services.crm.dynamics.com
North America 2https://admin.services.crm9.dynamics.com
Europe, Middle East and Africa (EMEA)https://admin.services.crm4.dynamics.com
Asia Pacific (APAC)https://admin.services.crm5.dynamics.com
Oceaniahttps://admin.services.crm6.dynamics.com
Japan (JPN)https://admin.services.crm7.dynamics.com
South Americahttps://admin.services.crm2.dynamics.com
India (IND)https://admin.services.crm8.dynamics.com
Canadahttps://admin.services.crm3.dynamics.com
United Kingdom (UK)https://admin.services.crm11.dynamics.com
Francehttps://admin.services.crm12.dynamics.com

Instance ID can be taken from CRM\Settings\Customisation\Developer Resources or you can run
Get-CrmInstances -ApiUrl “https://admin.services.crm4.dynamics.com”
to list your instances and find your Id for the respective CRM Instance.

Now we can run our command to disable admin mode for our CRM Instance easily.

$Username = “[email protected]
$Password = “password”
$SecPassword = ConvertTo-SecureString $Password -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential ($Username, $SecPassword)
Disable-CrmAdminMode -Id ‘Your Dynamics CRM Instance ID (GUID)’ -ApiUrl “Your Service URL from the table above” -Credential $Cred

This is all, now let’s check
Get-CrmInstance -Id “Your Dynamics CRM Instance ID (GUID)” -ApiUrl
Your Service URL from the table above -Credential $cred

Hope it helps


Leave a Reply

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

Kontrol / Control * Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.