prefect-azure
prefect-azure is a collection of Prefect integrations for orchestration workflows with Azure.
Getting Started
Installation
Install prefect-azure with pip
pip install prefect-azure
To use Blob Storage:
pip install "prefect-azure[blob_storage]"
To use Cosmos DB:
pip install "prefect-azure[cosmos_db]"
To use ML Datastore:
pip install "prefect-azure[ml_datastore]"
Managed identity authentication for the Prefect server database
prefect-azure provides a Prefect plugin that lets the Prefect server connect
to Azure Database for PostgreSQL using a Microsoft Entra ID (managed identity)
token instead of a password. When enabled, the server acquires a short-lived Entra
token via DefaultAzureCredential and supplies it to asyncpg on every new
connection, so tokens refresh automatically and no database password is stored
anywhere.
Enable it on the process running prefect server start (install prefect-azure
in that image/environment):
# Enable the plugin system so Prefect loads the database hook
# (on Prefect < 3.7 use PREFECT_EXPERIMENTS_PLUGINS_ENABLED=true instead)
export PREFECT_PLUGINS_ENABLED=true
export PREFECT_INTEGRATIONS_AZURE_POSTGRES_MANAGED_IDENTITY_ENABLED=true
# Optional: select a specific user-assigned identity
export PREFECT_INTEGRATIONS_AZURE_POSTGRES_MANAGED_IDENTITY_CLIENT_ID=<client-id>
# Provide a password-less connection URL (the plugin supplies the token)
export PREFECT_SERVER_DATABASE_CONNECTION_URL="postgresql+asyncpg://<entra-principal>@<host>:5432/<db>"
The Postgres server must have Microsoft Entra authentication enabled and the
identity mapped to a database role (via pgaadauth). Locally, DefaultAzureCredential
falls back to your az login identity, so the same configuration works for
development.
Examples
Download a blob
from prefect import flow
from prefect_azure import AzureBlobStorageCredentials
from prefect_azure.blob_storage import blob_storage_download
@flow
def example_blob_storage_download_flow():
connection_string = "connection_string"
blob_storage_credentials = AzureBlobStorageCredentials(
connection_string=connection_string,
)
data = blob_storage_download(
blob="prefect.txt",
container="prefect",
azure_credentials=blob_storage_credentials,
)
return data
example_blob_storage_download_flow()
Use with_options to customize options on any existing task or flow:
custom_blob_storage_download_flow = example_blob_storage_download_flow.with_options(
name="My custom task name",
retries=2,
retry_delay_seconds=10,
)
Azure Container Instance Worker
Use the Azure Container Instance worker to run flow runs in Azure Container Instances.
To get started, create an Azure Container Instances typed work pool:
prefect work-pool create --type azure-container-instance my-aci-work-pool
Then, run a worker that pulls jobs from the work pool:
prefect worker start --pool my-aci-work-pool --type azure-container-instance
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prefect_azure-0.4.13.tar.gz.
File metadata
- Download URL: prefect_azure-0.4.13.tar.gz
- Upload date:
- Size: 66.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e29a09d2e073d4a6e2b14889fc3f94978e1133300529cfd88ddabfcf481cc5b
|
|
| MD5 |
2577df7f70eaf6fad19588caa66cc64c
|
|
| BLAKE2b-256 |
a43e5451d1ffdfd91af9b81fed528fabb2111c3a5b0f1aed43b813909a0a3cc2
|
Provenance
The following attestation bundles were made for prefect_azure-0.4.13.tar.gz:
Publisher:
integration-package-release.yaml on PrefectHQ/prefect
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prefect_azure-0.4.13.tar.gz -
Subject digest:
0e29a09d2e073d4a6e2b14889fc3f94978e1133300529cfd88ddabfcf481cc5b - Sigstore transparency entry: 2761207862
- Sigstore integration time:
-
Permalink:
PrefectHQ/prefect@ac251d3d175db6ab6e034f43d9f1498ab3c6bc0b -
Branch / Tag:
refs/tags/prefect-azure-0.4.13 - Owner: https://github.com/PrefectHQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
integration-package-release.yaml@ac251d3d175db6ab6e034f43d9f1498ab3c6bc0b -
Trigger Event:
push
-
Statement type:
File details
Details for the file prefect_azure-0.4.13-py3-none-any.whl.
File metadata
- Download URL: prefect_azure-0.4.13-py3-none-any.whl
- Upload date:
- Size: 47.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd32c2912884b8823c3c6d583a913cde850eceab62d761c5d2aa41d0aae1f0fa
|
|
| MD5 |
df44647c57b8c083e667ccfaf008420a
|
|
| BLAKE2b-256 |
de2a83a66d37044f63c7e5d9d634a1f50b9058327e494f8dca6e7c7c35f4a819
|
Provenance
The following attestation bundles were made for prefect_azure-0.4.13-py3-none-any.whl:
Publisher:
integration-package-release.yaml on PrefectHQ/prefect
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prefect_azure-0.4.13-py3-none-any.whl -
Subject digest:
fd32c2912884b8823c3c6d583a913cde850eceab62d761c5d2aa41d0aae1f0fa - Sigstore transparency entry: 2761207900
- Sigstore integration time:
-
Permalink:
PrefectHQ/prefect@ac251d3d175db6ab6e034f43d9f1498ab3c6bc0b -
Branch / Tag:
refs/tags/prefect-azure-0.4.13 - Owner: https://github.com/PrefectHQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
integration-package-release.yaml@ac251d3d175db6ab6e034f43d9f1498ab3c6bc0b -
Trigger Event:
push
-
Statement type: