'How to load environment variable from azure key-vault in docker compose
Here I want to load the sql connection string from azure keyvault.
version: '3'
x-airflow-common:
&airflow-common
image: ${AIRFLOW_IMAGE_NAME:-apache/airflow:2.2.4-python3.8}
# build: .
environment:
&airflow-common-env
AIRFLOW__CORE__EXECUTOR: CeleryExecutor
AIRFLOW__CORE__SQL_ALCHEMY_CONN: mysql+mysqldb://airflow_user:[email protected]:3306/airflow_db
AIRFLOW__CELERY__RESULT_BACKEND: db+mysqldb://airflow_user:[email protected]:3306/airflow_db
AIRFLOW__CELERY__BROKER_URL: redis://:@redis:6379/0
AIRFLOW__CORE__FERNET_KEY: '
Solution 1:[1]
you need add to enviroment variables
AIRFLOW__SECRETS__BACKEND : airflow.providers.microsoft.azure.secrets.azure_key_vault.AzureKeyVaultBackend AIRFLOW__SECRETS__BACKEND_KWARGS : '{"connections_prefix=AIRFLOW-CONNECTIONS;variables_prefix=AIRFLOW-VARIABLES;vault_url=https://kvurl.vault.azure.net/"}'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | alexis.araya |