Skip to content

Commit

Permalink
docs(providers/microsoft): improve documentation for AzureCosmosDBHoo…
Browse files Browse the repository at this point in the history
…k DefaultAzureCredential support (apache#34102)
  • Loading branch information
Lee-W authored Sep 5, 2023
1 parent ef85c67 commit 4254cfc
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ The Microsoft Azure Cosmos connection type enables the Azure Cosmos Integrations
Authenticating to Azure
-----------------------

There is one way to connect to Azure Cosmos using Airflow.
There are two ways to connect to Azure Cosmos using Airflow.

1. Use `Primary Keys
<https://docs.microsoft.com/en-us/azure/cosmos-db/secure-access-to-data#primary-keys>`_
1. Use `Primary Keys`_
i.e. add specific credentials (client_id, secret, tenant) and account name to the Airflow connection.
2. Fallback on DefaultAzureCredential_.
This includes a mechanism to try different options to authenticate: Managed System Identity, environment variables, authentication through Azure CLI, etc.

Default Connection IDs
----------------------
Expand All @@ -44,15 +45,19 @@ Configuring the Connection
Login
Specify the Cosmos Endpoint URI used for the initial connection.

Password
Password (optional)
Specify the Cosmos Master Key Token used for the initial connection.
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 Cosmos connection.
The following parameters are all optional:

* ``database_name``: Specify the azure cosmos database to use.
* ``collection_name``: Specify the azure cosmos collection to use.
* ``subscription_id``: Specify the ID of the subscription used for the initial connection. Required for falling back to DefaultAzureCredential_
* ``resource_group_name``: Specify the Azure Resource Group Name under which the desired azure cosmos resides. Required for falling back to DefaultAzureCredential_


When specifying the connection in environment variable you should specify
it using URI syntax.
Expand All @@ -64,3 +69,7 @@ For example:
.. code-block:: bash
export AIRFLOW_CONN_AZURE_COSMOS_DEFAULT='azure-cosmos://https%3A%2F%2Fairflow.azure.com:master%20key@?database_name=mydatabase&collection_name=mycollection'
.. _Primary Keys: https://docs.microsoft.com/en-us/azure/cosmos-db/secure-access-to-data#primary-keys
.. _DefaultAzureCredential: https://docs.microsoft.com/en-us/python/api/overview/azure/identity-readme?view=azure-python#defaultazurecredential

0 comments on commit 4254cfc

Please sign in to comment.