Airflow Summit 2025 is coming October 07-09. Register now to secure your spot!

airflow.providers.microsoft.azure.hooks.base_azure

Classes

AzureBaseHook

This hook acts as a base hook for azure services.

Module Contents

class airflow.providers.microsoft.azure.hooks.base_azure.AzureBaseHook(sdk_client=None, conn_id='azure_default')[source]

Bases: airflow.providers.microsoft.azure.version_compat.BaseHook

This hook acts as a base hook for azure services.

It offers several authentication mechanisms to authenticate the client library used for upstream azure hooks.

Parameters:
  • sdk_client (Any) – The SDKClient to use.

  • conn_id (str) – The Azure connection id which refers to the information to connect to the service.

conn_name_attr = 'conn_id'[source]
default_conn_name = 'azure_default'[source]
conn_type = 'azure'[source]
hook_name = 'Azure'[source]
classmethod get_connection_form_widgets()[source]

Return connection widgets to add to connection form.

classmethod get_ui_field_behaviour()[source]

Return custom field behaviour.

sdk_client = None[source]
conn_id = 'azure_default'[source]
get_conn()[source]

Authenticate the resource using the connection id passed during init.

Returns:

the authenticated client.

Return type:

Any

get_credential(*, conn=None)[source]

Get Azure credential object for the connection.

Azure Identity based credential object (ClientSecretCredential, DefaultAzureCredential) can be used to get OAuth token using get_token method. Older Credential objects (ServicePrincipalCredentials, AzureIdentityCredentialAdapter) are supported for backward compatibility.

Returns:

The Azure credential object

Return type:

azure.common.credentials.ServicePrincipalCredentials | airflow.providers.microsoft.azure.utils.AzureIdentityCredentialAdapter | azure.identity.ClientSecretCredential | azure.identity.DefaultAzureCredential

get_token(*scopes, **kwargs)[source]

Request an access token for scopes.

To use this method, set use_azure_identity_object: True in the connection extra field. ServicePrincipalCredentials and AzureIdentityCredentialAdapter don’t support get_token method.

Was this entry helpful?