Skip to content

Commit

Permalink
Improve documentation for AzureBaseHook DefaultAzureCredential support (
Browse files Browse the repository at this point in the history
#34097)

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

* docs(providers/microsoft): add link to where DefaultAzureCredential is mentioned

* docs(providers/microsoft): extract links to doc end
  • Loading branch information
Lee-W authored Sep 5, 2023
1 parent 4ee0294 commit 6b92329
Showing 1 changed file with 18 additions and 9 deletions.
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

0 comments on commit 6b92329

Please sign in to comment.