Skip to main content

PowerShell Workflow runbooks are text runbooks based on Windows PowerShell Workflow.  

The CData cmdlets Driver for Salesforce enables to interact with Salesforce data from within your Azure Automation environment. This article shows how to establish a connection to Salesforce data in Azure PowerShell Runbook and use the portal editor to write script and make connection. 

Prerequisites 

  1. Azure Subscription: Ensure you have an Azure subscription and have access to Azure Automation. 

  1. Salesforce Account: Ensure you have a Salesforce account with the necessary permissions. 

Steps to Integrate Salesforce Cmdlets in an Azure PowerShell Runbook 

  1. Install CData Salesforce Cmdlets driver in your System 

  • Make sure to download the Zip Package (.zip) from Salesforce Cmdlets Download options as Azure powershell runbook supports module in the form of Zip Package only.  

 

 

 

 

  1. Prepare Azure Automation 

  1. Log in to the Azure Portal 

  1. Create an Azure Automation Account (if you don't have one already): 

  • Go to "Create a resource" > "Automation" > "Automation Account". 

  • Fill in the required fields and click "Create" to set up your Automation Account. 

 

  1. Import the Salesforce Cmdlets Module: 

  1. Go to the Automation Account you just created. 

  1. Import the SalesforceCmdlets Module: 

  • In the Automation Account, navigate to "Shared Resources" > "Modules" > “Add a module”. 

  • Click "Browse for file" and select a file. 

  • Select "SalesforceCmdlets" (The Zip Package that you downloaded when installing the connector)  

  • Select it and enter module name and Runtime version. Then click "Import" to upload the module to your Automation Account. 

                                   This step may take a few minutes as Azure prepares the module for use. 

 

 

 

  1. Create a Runbook 

  1. Navigate to the Runbooks Section: 

  • In your Automation Account, go to “Process Automation” > “Runbooks”. 

  1. Create a New Runbook: 

  • Click “Create a runbook”. 

  • Provide a name for the runbook. 

  • Select “PowerShell” as the Runbook type. 

  • Click “Review+Create” to create the runbook. 

 

 

 

  1. Write and Test your Script in the Runbook. 

  1. Open the Runbook for Editing: 

  • Once the runbook is created, it will open in the editor. 

  • If it doesn't open automatically, click on the runbook name and then click "Edit". 

  1. Write the PowerShell Script: 

  • In the editor, write your script to interact with Salesforce. Below is a sample script: 

 

 

  • Replace the placeholder values with your actual Salesforce account details. 

  • Ensure that you have given all the connection parameters required to make a successful connection. 

  • RTK (Run time key) is a connection property which must be given to successfully make the connection in Azure PowerShell Runbook. To get RTK you can contact [email protected]  

  1. Test the Script: 

  • Click “Test pane” at the top of the editor to open the testing pane. 

  • Click “Start” to execute the runbook. 

  • Monitor the output to ensure the script executes successfully and returns the expected results. 

 

 

 

  1. Publish the Runbook 

  1. Publish the Runbook: 

  • After successfully testing the script, click “Publish” at the top of the editor. 

  • This will make the runbook available for scheduling or manual execution.