Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Suggested answer

How to use Get-CrmConnection

Posted on by 1,000

Hi,

I try to use PowerShell to connect to Dynamics 365 online, but get errors. 

Get-CrmConnection -Interactive

I found this guide https://docs.microsoft.com/en-us/powershell/powerapps/get-started-connector?view=pa-ps-latest 

I downloaded this version MicrosoftDynamics365SDK.

Went through all steps

  1. At the prompt, change your directory to the folder that contains the PowerShell.dll file and the script for registering the cmdlets. For example: cd c:\SDK\bin
  2. Run the RegisterXRMTooling.ps1 script to register the XRM tooling PowerShell assembly, and install the Windows PowerShell snap-in. Type the following command, and press ENTER: .\RegisterXRMTooling.ps1
  3. Add the Windows PowerShell snap-in. This registers the Get-CrmConnection and Get-CrmOrganizations cmdlets. Add-PSSnapin Microsoft.Xrm.Tooling.Connector

Now I get connections error

pastedimage1662318917975v1.png

This is strange because all other tools work fine.

What I'm doing wrong?

I tried modern tools https://docs.microsoft.com/dynamics365/customer-engagement/developer/download-dynamics-365-sdk-v9 , but there is no RegisterXRMTooling at all.

Where is it?

How should I connect to

Categories:
  • Suggested answer
    Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Moderator on at
    RE: How to use Get-CrmConnection

    Hi Andrey Paltusov

    Glad to hear.

    Let me know if I can provide you with more details.

    Thanks
    Regards,

    Abdul Wahab
    Power Platform/Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp:+923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: www.linkedin.com/.../

  • Kipetcoff Profile Picture
    Kipetcoff 1,000 on at
    RE: How to use Get-CrmConnection

    I found solution.

    Here is article about it https://xrmdynamicscrm.wordpress.com/2020/09/13/dynamics-crm-connect-to-cds-using-xrmtooling-from-powershell/

    I got error with command Install-Module -Name Microsoft.Xrm.Tooling.CrmConnector.PowerShell, but I tried it on other computer and it works.

    Then I executed [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12

  • Kipetcoff Profile Picture
    Kipetcoff 1,000 on at
    RE: How to use Get-CrmConnection

    I've tried different logins from different regions.

    Here is the log.

    Looks like problem with connection address, may be something has changed in v9.

    As I understand this approach for v8 and earlier, and there is no update for v9.


    Source : System.ServiceModel
    Method : Retrieve
    Date : 05.09.2022
    Time : 10:19:40
    Error : Metadata contains an unresolvable link: "">disco.crm.dynamics.com/.../Discovery.svc
    Stack Trace : в System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.Retrieve(TimeoutHelper timeoutHelper)
    в System.ServiceModel.Description.MetadataExchangeClient.ResolveNext(ResolveCallState resolveCallState)
    в System.ServiceModel.Description.MetadataExchangeClient.GetMetadata(MetadataRetriever retriever)
    в Microsoft.Xrm.Sdk.Client.ServiceMetadataUtility.RetrieveServiceEndpointMetadata(Type contractType, Uri serviceUri, Boolean checkForSecondary)
    в Microsoft.Xrm.Sdk.Client.ServiceConfiguration`1..ctor(Uri serviceUri, Boolean checkForSecondary)
    в Microsoft.Xrm.Sdk.Client.ServiceConfigurationFactory.CreateManagement[TService](Uri serviceUri, Boolean enableProxyTypes, Assembly assembly)
    в Microsoft.Xrm.Tooling.Connector.CrmWebSvc.CreateAndAuthenticateProxy[T](IServiceManagement`1 servicecfg, Uri ServiceUri, Uri homeRealm, ClientCredentials userCredentials, ClientCredentials deviceCredentials, String LogString)
    в Microsoft.Xrm.Tooling.Connector.CrmWebSvc.DiscoverOrganizations(Uri discoveryServiceUri, Uri homeRealmUri, ClientCredentials clientCredentials, ClientCredentials deviceCredentials)
    в Microsoft.Xrm.Tooling.CrmConnectControl.CrmConnectionManager.QueryLiveDiscoveryServer(ClientCredentials liveCreds, Uri discoServer)
    в Microsoft.Xrm.Tooling.CrmConnectControl.CrmConnectionManager.FindCrmOnlineDiscoveryServer(ClientCredentials liveCreds)
    в Microsoft.Xrm.Tooling.CrmConnectControl.CrmConnectionManager.ValidateServerConnection(CrmOrgByServer selectedOrg)
    ======================================================================================================================
    Inner Exception Level 1 :
    Source : System
    Method : GetResponse
    Date : 05.09.2022
    Time : 10:19:40
    Error : The remote server returned an error: (404) Not found.
    Stack Trace : в System.Net.HttpWebRequest.GetResponse()
    в System.ServiceModel.Description.MetadataExchangeClient.MetadataLocationRetriever.DownloadMetadata(TimeoutHelper timeoutHelper)
    в System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.Retrieve(TimeoutHelper timeoutHelper)
    ======================================================================================================================

  • Suggested answer
    Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Moderator on at
    RE: How to use Get-CrmConnection

    Hi Andrey Paltusov,

    Please make sure first that your inputs are correct. 

    Double-check your region, from the note pad copy your user name and password and then paste them to the connection screen. If the issue is still there then, please error here. You can find errors by clicking on the view errors log link

    Let me know if I can provide you with more details.

    Thanks
    Regards,

    Abdul Wahab
    Power Platform/Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp:+923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: www.linkedin.com/.../

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,532 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,501 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans