Deployment guide

Prefect

Overview

Prefect is a Python workflow orchestration platform. It turns any Python function into an observable, schedulable workflow with retries, caching, concurrency limits and event-driven automation. You monitor every flow run, deployment and work pool from a web UI.

This SecureAnyCloud image installs Prefect 3.7.5 in a dedicated Python virtualenv. It runs the Prefect server as a systemd service, bound to loopback behind an nginx reverse proxy on port 80 with HTTP Basic auth.

What you get:

  • Prefect 3.7.5 in a Python virtualenv at /opt/prefect/venv
  • The Prefect server (UI and API) on :80 via nginx, with HTTP Basic auth
  • A unique admin password, generated on the first boot of every VM and stored in a root-only file (Prefect Server has no built-in auth)
  • A dedicated Azure data disk at /var/lib/prefect that holds the SQLite state database (flow runs, deployments, config). It is separate from the OS disk and re-provisioned with every VM
  • prefect-server.service and nginx.service as systemd units, enabled and active
  • 24/7 SecureAnyCloud support

Prerequisites

  • An active Azure subscription, an SSH key pair, and a VNet with a subnet in the target region
  • NSG inbound rules that allow 22/tcp from your management network and 80/tcp for the UI and API. Front the UI with TLS for public exposure (see Enabling HTTPS)

Standard_B2ms (2 vCPU, 8 GiB RAM) is a good starting point. Scale up for many concurrent flow runs.

Step 1 - Deploy from the Azure Marketplace

Sign in to the Azure Portal. Choose Create a resource, search the Marketplace for Prefect by SecureAnyCloud, and select Create.

On Basics, pick your subscription, resource group, region and size. Under Administrator account, choose SSH public key and paste your key. Under Inbound port rules, allow SSH (22) and HTTP (80).

Review the dedicated data disk on the Disks tab. Then select Review + create and Create.

Step 2 - Deploy from the Azure CLI

# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:prefect-ubuntu-24-04:default:latest
az vm create \
  --resource-group <your-rg> \
  --name prefect \
  --image sac1647283583153:prefect-ubuntu-24-04:default:latest \
  --size Standard_B2ms \
  --admin-username azureuser \
  --ssh-key-values ~/.ssh/id_ed25519.pub \
  --vnet-name <your-vnet> --subnet <your-subnet> \
  --public-ip-sku Standard
az vm open-port --resource-group <your-rg> --name prefect --port 80 --priority 1010

Step 3 - Connect to your VM

ssh azureuser@<vm-public-ip>

Step 4 - Confirm the services are running

systemctl is-active prefect-server.service nginx.service

Both services report active. The Prefect server runs a database migration on first boot, and then serves the UI and API.

Step 5 - Retrieve your password

The admin password is generated uniquely on the first boot of your VM and written to a root-only file:

sudo cat /root/prefect-credentials.txt

This file contains PREFECT_ADMIN_USER (admin), PREFECT_ADMIN_PASSWORD and the URLs. Store the password in a safe place.

Step 6 - Check the health endpoint

nginx serves an unauthenticated health endpoint for load balancers and probes. Request it:

curl -s http://localhost/health

The endpoint returns ok.

Step 7 - Open the Prefect UI

Browse to http://<vm-public-ip>/ and sign in as admin with the password from Step 5. The dashboard summarises recent flow-run activity. The Runs, Flows, Deployments and Work Pools pages let you drill into every pipeline.

The Runs page charts and lists every flow run with its state. Open a run to see its task runs, timeline and logs.

Step 8 - Confirm the API from the command line

The Prefect API is available behind the same Basic auth. Confirm that it is healthy and report how many flow runs it is tracking:

curl -s -u admin:<PREFECT_ADMIN_PASSWORD> http://localhost/api/health; echo
curl -s -u admin:<PREFECT_ADMIN_PASSWORD> -X POST -H 'Content-Type: application/json' -d '{}' http://localhost/api/flow_runs/count; echo

/api/health returns true, and the count endpoint returns the number of flow runs.

Step 9 - Point a client or worker at the server

On your laptop or a worker machine, install Prefect and point it at this server's API. The credentials go in the URL. Then run a flow:

pip install prefect==3.7.5 prefect config set PREFECT_API_URL="http://admin:<password>@<vm-public-ip>/api"
# my_flow.py from prefect import flow @flow(log_prints=True) def hello(name: str = "world"): print(f"Hello {name} from Prefect on Azure!") if __name__ == "__main__": hello()

Run python my_flow.py, and the run appears in the UI. To run flows on a schedule, create a work pool and deploy them with prefect deploy.

Step 10 - Confirm state lives on the dedicated disk

The Prefect home and its SQLite database are stored on the dedicated Azure data disk, so they survive OS changes and can be resized independently:

findmnt /var/lib/prefect

The mount is backed by a separate Azure data disk. The disk is captured into the image and re-provisioned on every VM.

Enabling HTTPS

The nginx reverse proxy terminates plain HTTP on port 80. For public exposure, put a certificate in front of it. Add a DNS name for the VM, and then choose one of two options:

  • Use the companion SecureAnyCloud nginx-ssl-certbot image as a TLS reverse proxy.
  • Install certbot and extend the existing nginx site with a listen 443 ssl; server block.

Keep the Prefect server bound to loopback, so that the only public surface is the authenticated, TLS-terminated proxy.

Maintenance

  • Backups: snapshot the /var/lib/prefect data disk to back up flow runs and deployments.
  • Database: the image uses SQLite, which suits a single server. For high throughput, migrate PREFECT_HOME/the API to PostgreSQL.
  • Upgrades: run sudo /opt/prefect/venv/bin/pip install -U prefect, and then sudo systemctl restart prefect-server.
  • Security patches: unattended-upgrades remains enabled, so the OS continues to receive security updates automatically.

Support

SecureAnyCloud provides 24/7 expert support for this image. Contact sales@secureanycloud.com.

Deploy on Azure

Launch Prefect on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.

View this image

Need Help?

Our support team is available 24/7.

sales@secureanycloud.com

Deploy on Azure