How to deploy Prefect 2.0 flows to Azure

Create an Azure block

First, go to the Prefect UI and create an Azure block:

Create a deployment from CLI

This will assume that you want to run your flow in a local process, i.e. using a Process block. To use a different type of infrastructure, check recipes for Docker and Kubernetes.

prefect deployment build flows/hello.py:hello \
--name dev --tag dev --storage-block azure/dev

prefect deployment apply deployment.yaml

You should now see the entire project copied into your Azure container :tada:

When you run the build and apply commands, you should expect output similar to:

Interesting note: the Dockerfile and YAML file hello-deployment.yaml have not been uploaded because we added a .prefectignore file:

# prefect artifacts
.prefectignore
Dockerfile
*.yaml

# python artifacts
__pycache__/
*.py[cod]
*$py.class
*.egg-info/
*.egg

Start an agent

prefect agent start --tag dev

You should see that your agent picked up the run:

You’re all set! :rocket: