Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)
Under review by Community Managers

Under review

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

Using Microsoft.Xrm.Data.Powershell with azure automation powershell runbook

Posted on by

I am trying to use Microsoft.Xrm.Data.Powershell in my azure automation account powershell runbook.

I have installed the module in automation account.

But when I am trying to connect to my CRM Organisation, I am facing an error.

Command I am using:

Connect-CrmOnline -ClientSecret $csecret -OAuthClientId $cid -ServerUrl $CRMSourceUrl -Verbose

 

Error I see:

 

Unable to connect to CRM: Could not load file or assembly 'System.Runtime,
                                      Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its
                                      dependencies. The system cannot find the file specified.
                                      Could not load file or assembly 'System.Runtime, Version=4.2.1.0,
                                      Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The
                                      system cannot find the file specified.Unable to Login to Dynamics CRM
                                      Unable to Login to Dynamics CRMOrganizationWebProxyClient is null
                                      OrganizationWebProxyClient is nullOrganizationWebProxyClient is null
                                      OrganizationWebProxyClient is nullOrganizationWebProxyClient is null
                                      OrganizationWebProxyClient is nullOrganizationWebProxyClient is null
                                      OrganizationWebProxyClient is nullOrganizationWebProxyClient is null
                                      OrganizationWebProxyClient is null

Module version I am using is 2.8.14 which is the latest one.

Kindly have a note that I have tried to install the module to automation account by all 3 ways (through uploading zip file, from installing through powershell gallery portal, and from azure portal by browsing through gallery) 

But facing issue at the first step for establishing connection. 

Also note that the same command, credential etc works fine when I am trying them from my local machine.

I am not sure what is wrong when using the same script in Azure Automation Account Powershell runbook? 

Any help regarding this is much more appreciated. 

Many thanks in advance

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans