Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(providers/microsoft): improve documentation for AzureBaseHook DefaultAzureCredential support #34097

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,16 @@ The Microsoft Azure connection type enables the Azure Integrations.
Authenticating to Azure
-----------------------

There are three ways to connect to Azure using Airflow.
There are four ways to connect to Azure using Airflow.

1. Use `token credentials
<https://docs.microsoft.com/en-us/azure/developer/python/azure-sdk-authenticate?tabs=cmd#authenticate-with-token-credentials>`_
1. Use `token credentials`_
i.e. add specific credentials (client_id, secret, tenant) and subscription id to the Airflow connection.
2. Use a `JSON file
<https://docs.microsoft.com/en-us/azure/developer/python/azure-sdk-authenticate?tabs=cmd#authenticate-with-a-json-file>`_
i.e. create a key file on disk and link to it in the Airflow connection.
3. Use a `JSON dictionary
<https://docs.microsoft.com/en-us/azure/developer/python/azure-sdk-authenticate?tabs=cmd#authenticate-with-a-json-dictionary>`_
2. Use a `JSON file`_
3. Use a `JSON dictionary`_
i.e. add a key config directly into the Airflow connection.
4. Fallback on `DefaultAzureCredential`_.
This includes a mechanism to try different options to authenticate: Managed System Identity, environment variables, authentication through Azure CLI and etc.
``subscriptionId`` is required in this authentication mechanism.

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.
Expand All @@ -53,10 +52,12 @@ Configuring the Connection
Login (optional)
Specify the ``client_id`` used for the initial connection.
This is only needed for *token credentials* authentication mechanism.
It can be left out to fall back on DefaultAzureCredential_.

Password (optional)
Specify the ``secret`` used for the initial connection.
This is only needed for *token credentials* authentication mechanism.
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.
Expand All @@ -65,12 +66,14 @@ Extra (optional)
* ``tenantId``: Specify the tenant to use.
This is only needed for *token credentials* authentication mechanism.
* ``subscriptionId``: Specify the subscription id to use.
This is only needed for *token credentials* authentication mechanism.
This is only needed for *token credentials* and DefaultAzureCredential_ authentication mechanism.
* ``key_path``: If set, it uses the *JSON file* authentication mechanism.
It specifies the path to the json file that contains the authentication information.
* ``key_json``: If set, it uses the *JSON dictionary* authentication mechanism.
It specifies the json that contains the authentication information.

The entire extra column can be left out to fall back on DefaultAzureCredential_.

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

Expand All @@ -81,3 +84,9 @@ For example:
.. code-block:: bash

export AIRFLOW_CONN_AZURE_DEFAULT='azure://?key_path=%2Fkeys%2Fkey.json'


.. _token credentials: https://docs.microsoft.com/en-us/azure/developer/python/azure-sdk-authenticate?tabs=cmd#authenticate-with-token-credentials
.. _JSON file: https://docs.microsoft.com/en-us/azure/developer/python/azure-sdk-authenticate?tabs=cmd#authenticate-with-a-json-file
.. _JSON dictionary: https://docs.microsoft.com/en-us/azure/developer/python/azure-sdk-authenticate?tabs=cmd#authenticate-with-a-json-dictionary>
.. _DefaultAzureCredential: https://docs.microsoft.com/en-us/python/api/overview/azure/identity-readme?view=azure-python#defaultazurecredential