Running Scripts using Azure Data Factory and Batch, Part I
Power BI is Microsoft’s data visualization solution

A common job in orchestration is to run a python or R script within a pipeline. To achieve this, one can run scripts using Azure Data Factory (ADF) and Azure Batch.

The following is an example on how to run a script using ADF and Azure Batch. Before starting, make sure you have and batch account and a pool, and a storage account.

Say you would like to run the script helloWorld.py in ADF using Azure Batch:

print('hello world')

To run this script in a pipeline:

  1. From Azure Batch, go to Blob service > Containers

    2021-03-07-running-script-adf-1-img01

  2. Click on + Container

    2021-03-07-running-script-adf-1-img02

  3. Name your new script container and click on Create

    2021-03-07-running-script-adf-1-img03

  4. Access the script container

    2021-03-07-running-script-adf-1-img04

  5. Click on Upload

    2021-03-07-running-script-adf-1-img05

  6. Locate the script helloWorld.py in your local folders and upload

    2021-03-07-running-script-adf-1-img06

  7. Navigate to the ADF portal. Click on Manage

    2021-03-07-running-script-adf-1-img07

  8. Go to Linked services > + New

    2021-03-07-running-script-adf-1-img08

  9. Under Data store, select Azure Blob Storage > Continue

    2021-03-07-running-script-adf-1-img09.jpg

  10. Name the linked service. Select the Azure Subscription under which the storage account was created. From the drop-down menu, select your Storage account name > Create

    2021-03-07-running-script-adf-1-img10

  11. Create a new linked service by going to Linked services > +New. Under Compute services. Select Azure Batch > Continue

    2021-03-07-running-script-adf-1-img11

  12. To find the required Batch information, refer to Azure Batch. Go to Settings > Keys

    2021-03-07-running-script-adf-1-img12.jpg

  13. Here you will find three of the fields required: Account Name, Access Key and Batch URL

    2021-03-07-running-script-adf-1-img13

  14. To find the Pool Name, refer to Features > Pools on the left-hand side menu from your main batch account site.

    2021-03-07-running-script-adf-1-img14

  15. The Pool ID is the Pool name.

    2021-03-07-running-script-adf-1-img15

  16. Go back to the ADF portal, and fill out the information required. Under Storage linked service name, select the linked service for the storage account created above. Create

    2021-03-07-running-script-adf-1-img16

Now you have created the linked services to Azure Batch and Storage. In part II, you find the steps to create and run the pipeline.

Running Scripts using Azure Data Factory and Batch, Part I
Older post

4 x 4 x 48

Going through with the running challenge popularized by David Goggins

Newer post

Running Scripts using Azure Data Factory and Batch, Part II

An example on how to run scripts within an Azure Data Factory pipeline

Running Scripts using Azure Data Factory and Batch, Part I