• Home
  • About Us
  • Contact Us
  • Privacy Policy
  • Special Offers
Business Intelligence Info
  • Business Intelligence
    • BI News and Info
    • Big Data
    • Mobile and Cloud
    • Self-Service BI
  • CRM
    • CRM News and Info
    • InfusionSoft
    • Microsoft Dynamics CRM
    • NetSuite
    • OnContact
    • Salesforce
    • Workbooks
  • Data Mining
    • Pentaho
    • Sisense
    • Tableau
    • TIBCO Spotfire
  • Data Warehousing
    • DWH News and Info
    • IBM DB2
    • Microsoft SQL Server
    • Oracle
    • Teradata
  • Predictive Analytics
    • FICO
    • KNIME
    • Mathematica
    • Matlab
    • Minitab
    • RapidMiner
    • Revolution
    • SAP
    • SAS/SPSS
  • Humor

Run Microsoft.Xrm.Data.PowerShell on Azure Automation

March 16, 2016   Microsoft Dynamics CRM

Hi all,

When we announced Microsoft.Xrm.Data.PowerShell in this article, we got some feedback that you want to run the module on Azure Automation. Yes we hear you and here comes the latest module which supports Azure Automation!

Please get the latest module from GitHub (Please download version 2.x)

What’s Azure Automation?

Before showing “how to” part, I will explain what is Azure Automation in case you do not know about it. You can consider Azure Automation as PaaS. It provides a place to run PowerShell scripts. You don’t have to worry about Operating Systems nor clustering for High Availability, nor Infrastructure. Azure Automation also provides various capabilities.

– You can upload your own modules.
– You can store variables such as Credential, String, etc.
– You can schedule the task.
– You can draft and run test session, before “publish” the script.
– Integration with services such as GitHub, your own services, etc.

Please find more detail about Azure Automation here.

Step by Step instructions

It’s time to play with it. Please follow the steps below to create your first script running on the cloud, which disables “Display welcome screen to users when they sign in” System Settings.

Create Azure Automation Account

1. Login to Azure Portal. If you do not have any Azure Subscription, please sign up for 30 days trial. http://portal.azure.com

2. Click Browse | Automation Accounts from the list and click “Add” in the list.

4073.image 5F00 thumb Run Microsoft.Xrm.Data.PowerShell on Azure Automation

4111.image 5F00 thumb 5F00 1 Run Microsoft.Xrm.Data.PowerShell on Azure Automation

3. Check if correct Subscription is selected, then enter name. Then click “Create” button.

4. Go back to Automation Accounts list to confirm the account has been created.

Add Assets

Next step is to add Assets. Asset is a place where you store your own stuff, such as PowerShell modules and variables.

1. Open added Automation Account and click Assets.

4544.image 5F00 thumb 5F00 2 Run Microsoft.Xrm.Data.PowerShell on Azure Automation

2. Click Modules.

7367.image 5F00 thumb 5F00 3 Run Microsoft.Xrm.Data.PowerShell on Azure Automation

3. Click “Add a module” button.

4. Click folder icon to browse module.

5. Select Microsoft.Xrm.Data.PowerShell.zip which you download from GitHub, and click “OK”.

3414.image 5F00 thumb 5F00 4 Run Microsoft.Xrm.Data.PowerShell on Azure Automation

6. Next, add credential. Click Credentials.

1781.image 5F00 thumb 5F00 5 Run Microsoft.Xrm.Data.PowerShell on Azure Automation

7. Click “Add a credential” button.

8. Enter credential detail and click “Create”.

0310.image 5F00 thumb 5F00 6 Run Microsoft.Xrm.Data.PowerShell on Azure Automation

9. Lastly, add CRM Server URL. Click “Variables”.

10. Click “Add a variable” and enter CRM server URL as “string” variable. Click “Create”.

28034.image 5F00 thumb 5F00 7 Run Microsoft.Xrm.Data.PowerShell on Azure Automation

Create Runbook

Now you are ready to write first script! To do so, you need to create a runbook, which will contain your script.

1. Go back to your automation account blade, and click Runbooks.

4530.image 5F00 thumb 5F00 9 Run Microsoft.Xrm.Data.PowerShell on Azure Automation

2. Click “Add a runbook” button, and select “Create a new runbook”.

3. Enter a name as “SetNavigationTourOff” and select “PowerShell” from Runbook type, then click “Create”.

7382.image 5F00 thumb 5F00 10 Run Microsoft.Xrm.Data.PowerShell on Azure Automation

4. Once the runbook created, select the runbook and click Edit.

6283.image 5F00 thumb 5F00 11 Run Microsoft.Xrm.Data.PowerShell on Azure Automation

5. Firstly, you get credential and CRM Server URL from variables. Expand “ASSETS” | “Variables” and right click “CRM Server” variable. Then, select Add “Get Variables” to canvas menu, which inserts a script to get the variable.

2350.image 5F00 thumb 5F00 12 Run Microsoft.Xrm.Data.PowerShell on Azure Automation

6. Modify the script to store the result to $ crmserver variable.

7142.image 5F00 thumb 5F00 13 Run Microsoft.Xrm.Data.PowerShell on Azure Automation

7. Expand “Credentials” and right click “CrmCred”, then select Add to canvas.

8. Change the script to store the result to $ cred variable.

1462.image 5F00 thumb 5F00 14 Run Microsoft.Xrm.Data.PowerShell on Azure Automation

9. Next, you connect to your CRM organization. Expand “CMDLETS” | “Microsoft,Xrm.Data.PowerShell” and right click “Connect-CrmOnline”, then click “Add to canvas”. Modify the script to store the connection to $ conn variable, and pass parameters you obtained above.

4265.image 5F00 thumb 5F00 15 Run Microsoft.Xrm.Data.PowerShell on Azure Automation

10. Lastly, put the following script to the canvas either by typing or from left menu. The entire script looks like this.

3288.image 5F00 thumb 5F00 17 Run Microsoft.Xrm.Data.PowerShell on Azure Automation

11. Click “Save” to save the change.

Test the runbook

Once you crafted the script, you need to test it.

1. Click “Test Pane” button.

1050.image 5F00 thumb 5F00 18 Run Microsoft.Xrm.Data.PowerShell on Azure Automation

2. Click “Start” to run the test, and wait until it’s completed.

3632.image 5F00 thumb 5F00 19 Run Microsoft.Xrm.Data.PowerShell on Azure Automation

0844.image 5F00 thumb 5F00 20 Run Microsoft.Xrm.Data.PowerShell on Azure Automation

3. Once completed, login to your CRM to see if “Display welcome screen to users when they sign in” System Settings has been disabled.

5822.image 5F00 thumb 5F00 21 Run Microsoft.Xrm.Data.PowerShell on Azure Automation

Publish the runbook

Once you confirmed it works as expected, you publish the script.

1. Click “Publish” button. Click “Yes” for confirmation dialog.

0882.image 5F00 thumb 5F00 22 Run Microsoft.Xrm.Data.PowerShell on Azure Automation

2. You can also set scheduling. Click “Schedule” button.

4628.image 5F00 thumb 5F00 23 Run Microsoft.Xrm.Data.PowerShell on Azure Automation

3. Create your schedule as you need.

Conclusion

Microsoft.Xrm.Data.PowerShell is compatible with cloud now, and you can bring everything to the cloud. You may still need VM or local computer if you need to keep running the script less than every hour though, as minimum scheduling period is an hour for Azure Automation as of now.

Ken
Premier Mission Critical/Premier Field Engineer
Microsoft Japan

Let’s block ads! (Why?)

Dynamics CRM in the Field

Automation, Azure, Microsoft.Xrm.Data.PowerShell
  • Recent Posts

    • WATCH: ‘Coming 2 America’ Movie Review Available On Amazon Prime & Amazon
    • IBM launches AI platform to discover new materials
    • 3 Ways a Microsoft Dynamics 365 Supply Chain Management and EDI Integration Enhance E-Commerce CRM Strategy
    • The Neanderthals
    • What the swarm of new Azure announcements mean
  • Categories

  • Archives

    • March 2021
    • February 2021
    • January 2021
    • December 2020
    • November 2020
    • October 2020
    • September 2020
    • August 2020
    • July 2020
    • June 2020
    • May 2020
    • April 2020
    • March 2020
    • February 2020
    • January 2020
    • December 2019
    • November 2019
    • October 2019
    • September 2019
    • August 2019
    • July 2019
    • June 2019
    • May 2019
    • April 2019
    • March 2019
    • February 2019
    • January 2019
    • December 2018
    • November 2018
    • October 2018
    • September 2018
    • August 2018
    • July 2018
    • June 2018
    • May 2018
    • April 2018
    • March 2018
    • February 2018
    • January 2018
    • December 2017
    • November 2017
    • October 2017
    • September 2017
    • August 2017
    • July 2017
    • June 2017
    • May 2017
    • April 2017
    • March 2017
    • February 2017
    • January 2017
    • December 2016
    • November 2016
    • October 2016
    • September 2016
    • August 2016
    • July 2016
    • June 2016
    • May 2016
    • April 2016
    • March 2016
    • February 2016
    • January 2016
    • December 2015
    • November 2015
    • October 2015
    • September 2015
    • August 2015
    • July 2015
    • June 2015
    • May 2015
    • April 2015
    • March 2015
    • February 2015
    • January 2015
    • December 2014
    • November 2014
© 2021 Business Intelligence Info
Power BI Training | G Com Solutions Limited