alexbegg commented on a change in pull request #9639:
URL: https://github.com/apache/airflow/pull/9639#discussion_r452709383



##########
File path: airflow/providers/microsoft/azure/secrets/azure_key_vault.py
##########
@@ -0,0 +1,131 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from typing import Optional
+
+from azure.core.exceptions import ResourceNotFoundError
+from azure.identity import DefaultAzureCredential
+from azure.keyvault.secrets import SecretClient
+from cached_property import cached_property
+
+from airflow.secrets import BaseSecretsBackend
+from airflow.utils.log.logging_mixin import LoggingMixin
+
+
+class AzureKeyVaultBackend(BaseSecretsBackend, LoggingMixin):
+    """
+    Retrieves Airflow Connections or Variables from Azure Key Vault secrets.
+
+    The Azure Key Vault can be configred as a secrets backend in the 
``airflow.cfg``:
+
+    .. code-block:: ini
+
+        [secrets]
+        backend = 
airflow.providers.microsoft.azure.secrets.azure_key_vault.AzureKeyVaultBackend
+        backend_kwargs = {"connections_prefix": "airflow-connections", 
"vault_url": "<azure_key_vault_uri>"}
+
+    For example, if the secrets prefix is 
``airflow-connections-smtp-default``, this would be accessible
+    if you provide ``{"connections_prefix": "airflow-connections"}`` and 
request conn_id ``smtp-default``.
+    And if variables prefix is ``airflow-variables-hello``, this would be 
accessible
+    if you provide ``{"variables_prefix": "airflow-variables"}`` and request 
variable key ``hello``.
+
+    :param vault_url: The URL of an Azure Key Vault to use

Review comment:
       One more: also put vault_url after variables_prefix here too




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to