Microsoft Azure Blob Storage Connection

The Microsoft Azure Blob Storage connection type enables the Azure Blob Storage Integrations.

Authenticating to Azure Blob Storage

There are six ways to connect to Azure Blob Storage using Airflow.

  1. Use token credentials i.e. add specific credentials (client_id, secret, tenant) and subscription id to the Airflow connection.

  2. Use Azure Shared Key Credential i.e. add shared key credentials to shared_access_key the Airflow connection.

  3. Use a SAS Token i.e. add a key config to sas_token in the Airflow connection.

  4. Use a Connection String i.e. add connection string to connection_string in the Airflow connection.

  5. Use managed identity by setting managed_identity_client_id, workload_identity_tenant_id (under the hook, it uses DefaultAzureCredential with these arguments)

  6. Fallback on DefaultAzureCredential. This includes a mechanism to try different options to authenticate: Managed System Identity, environment variables, authentication through Azure CLI, etc.

Only one authorization method can be used at a time. If you need to manage multiple credentials or keys then you should configure multiple connections.

Default Connection IDs

All hooks and operators related to Microsoft Azure Blob Storage use wasb_default by default.

Configuring the Connection

Login (optional)

Specify the login used for Azure Blob Storage. Strictly needed for Active Directory (token) authentication as Service principle credential. Optional for the rest if host (account url) is specified. It can be left out to fall back on DefaultAzureCredential.

Password (optional)

Specify the password used for Azure Blob Storage. For use with Active Directory (token credential) and shared key authentication. It can be left out to fall back on DefaultAzureCredential.

Host (optional)

Specify the account url for Azure Blob Storage. Strictly needed for Active Directory (token) and DefaultAzureCredential authentication as Service principle credential. Optional for the rest if login (account name) is specified.

Blob Storage Connection String (optional)

Connection string for use with connection string authentication It can be left out to fall back on DefaultAzureCredential..

Blob Storage Shared Access Key (optional)

Specify the shared access key. Needed only for shared access key authentication. It can be left out to fall back on DefaultAzureCredential.

SAS Token (optional)

SAS Token for use with SAS Token authentication. It can be left out to fall back on DefaultAzureCredential.

Tenant Id (Active Directory Auth) (optional)

Specify the tenant to use. Required only for Active Directory (token) authentication. It can be left out to fall back on DefaultAzureCredential.

Extra (optional)

Specify the extra parameters (as json dictionary) that can be used in Azure connection. The following parameters are all optional:

  • client_secret_auth_config: Extra config to pass while authenticating as a service principal using ClientSecretCredential It can be left out to fall back on DefaultAzureCredential.

  • managed_identity_client_id: The client ID of a user-assigned managed identity. If provided with workload_identity_tenant_id, they’ll pass to DefaultAzureCredential.

  • workload_identity_tenant_id: ID of the application’s Microsoft Entra tenant. Also called its “directory” ID. If provided with managed_identity_client_id, they’ll pass to DefaultAzureCredential.

When specifying the connection in environment variable you should specify it using URI syntax.

Note that all components of the URI should be URL-encoded.

For example connect with token credentials:

export AIRFLOW_CONN_WASB_DEFAULT='wasb://blob%20username:blob%20password@myblob.com?tenant_id=tenant+id'

Was this entry helpful?