airflow.providers.microsoft.azure.utils

Module Contents

Classes

AzureIdentityCredentialAdapter

Adapt azure-identity credentials for backward compatibility.

Functions

get_field(*, conn_id, conn_type, extras, field_name)

Get field from extra, first checking short name, then for backcompat we check for prefixed name.

add_managed_identity_connection_widgets(func)

parse_blob_account_url(host, login)

Attributes

get_sync_default_azure_credential

get_async_default_azure_credential

airflow.providers.microsoft.azure.utils.get_field(*, conn_id, conn_type, extras, field_name)[source]

Get field from extra, first checking short name, then for backcompat we check for prefixed name.

airflow.providers.microsoft.azure.utils.get_sync_default_azure_credential: functools.partial[azure.identity.DefaultAzureCredential][source]
airflow.providers.microsoft.azure.utils.get_async_default_azure_credential: functools.partial[azure.identity.aio.DefaultAzureCredential][source]
airflow.providers.microsoft.azure.utils.add_managed_identity_connection_widgets(func)[source]
class airflow.providers.microsoft.azure.utils.AzureIdentityCredentialAdapter(credential=None, resource_id='https://management.azure.com/.default', *, managed_identity_client_id=None, workload_identity_tenant_id=None, **kwargs)[source]

Bases: msrest.authentication.BasicTokenAuthentication

Adapt azure-identity credentials for backward compatibility.

Adapt credentials from azure-identity to be compatible with SD that needs msrestazure or azure.common.credentials

Check https://stackoverflow.com/questions/63384092/exception-attributeerror-defaultazurecredential-object-has-no-attribute-sig

set_token()[source]

Ask the azure-core BearerTokenCredentialPolicy policy to get a token.

Using the policy gives us for free the caching system of azure-core. We could make this code simpler by using private method, but by definition I can’t assure they will be there forever, so mocking a fake call to the policy to extract the token, using 100% public API.

signed_session(azure_session=None)[source]

Create requests session with any required auth headers applied.

If a session object is provided, configure it directly. Otherwise, create a new session and return it.

Parameters

session (requests.Session) – The session to configure for authentication

Return type

requests.Session

airflow.providers.microsoft.azure.utils.parse_blob_account_url(host, login)[source]

Was this entry helpful?