Options for running Python scripts in Azure

For your needs, I suggest you use Web Jobs in Web Apps Service.

It has two types of Azure Web Jobs for you to choose:
Continuous and Trigger.
For your needs, Trigger should be adopted.

You could refer to the document here for more details.In addition, here shows how to run tasks in WebJobs.

I created a simple Trigger webjob for your reference.

Step 1: I write a Sample.py as below:

enter image description here

I used the python third-party module virtualenv create a isolated python environment and used the pip install requests command line to download the libs packages that the requests depend on.

enter image description here


then keep the Sample.py uniformly compressed into a folder with the libs packages dependent on the requests that you rely on.

enter image description here

Step 2: Create webjob in Web app service. Here, I choose Triggered Type and set cron expression 0/5 * * * * * which means this job will be excuted per 5 seconds.

enter image description here

you’ll see the Web Job list after your successful creation.

Step 3: You could check your running web job’s status and logs via the Logs button as below:

enter image description here

enter image description here

enter image description here

Leave a Comment