I have a Python script that gets data from Google Analytics and puts in into a CSV file. I currently run this script on a local machine but I'd like to run the script in my companies Azure tenant. What Azure service could / should I use to run this script on a daily schedule?
Deploy your Python code to Azure for web apps, serverless apps, containers, and machine learning models. Take advantage of the Azure libraries (SDK) for Python to programmatically access the full range of Azure services including storage, databases, pre-built AI capabilities, and much more.
Loading Data Once you have logged into your Azure Machine Learning Studio account, click on the EXPERIMENTS option, listed on the left sidebar, followed by the NEW button. Next, click on the blank experiment and the new workspace will be displayed. Give the name Execute Scripts to the workspace.
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:
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.
then keep the Sample.py uniformly compressed into a folder with the libs packages dependent on the requests that you rely on.
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.
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With