Skip to main content

prefect-azure

PyPI

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

prefect_azure-0.4.13.tar.gz (66.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prefect_azure-0.4.13-py3-none-any.whl (47.1 kB view details)

Uploaded Python 3

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

Hashes for prefect_azure-0.4.13.tar.gz
Algorithm Hash digest
SHA256 0e29a09d2e073d4a6e2b14889fc3f94978e1133300529cfd88ddabfcf481cc5b
MD5 2577df7f70eaf6fad19588caa66cc64c
BLAKE2b-256 a43e5451d1ffdfd91af9b81fed528fabb2111c3a5b0f1aed43b813909a0a3cc2

See more details on using hashes here.

Provenance

The following attestation bundles were made for prefect_azure-0.4.13.tar.gz:

Publisher: integration-package-release.yaml on PrefectHQ/prefect

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for prefect_azure-0.4.13-py3-none-any.whl
Algorithm Hash digest
SHA256 fd32c2912884b8823c3c6d583a913cde850eceab62d761c5d2aa41d0aae1f0fa
MD5 df44647c57b8c083e667ccfaf008420a
BLAKE2b-256 de2a83a66d37044f63c7e5d9d634a1f50b9058327e494f8dca6e7c7c35f4a819

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.4.13 This release

2 files

0.4.12

2 files

0.4.11

2 files

0.4.10

2 files

0.4.9

2 files

0.4.8

2 files

0.4.7

2 files

0.4.6

2 files

0.4.5

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.11

2 files

0.3.10

2 files

0.3.9

2 files

0.3.8

2 files

0.3.7

2 files

0.3.6

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.12

2 files

0.2.11

2 files

0.2.10

2 files

0.2.9

2 files

0.2.8

2 files

0.2.7

2 files

0.2.6

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page