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
-
Azure Subscription: Ensure you have an Azure subscription and have access to Azure Automation.
-
Salesforce Account: Ensure you have a Salesforce account with the necessary permissions.
Steps to Integrate Salesforce Cmdlets in an Azure PowerShell Runbook
-
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.
-
Prepare Azure Automation
-
Log in to the Azure Portal
-
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.
-
Import the Salesforce Cmdlets Module:
-
Go to the Automation Account you just created.
-
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.
-
Create a Runbook
-
Navigate to the Runbooks Section:
-
In your Automation Account, go to “Process Automation” > “Runbooks”.
-
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.
-
Write and Test your Script in the Runbook.
-
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".
-
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]
-
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.
-
Publish the Runbook
-
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.