0
0
Apache Airflowdevops~20 mins

Secrets management in Apache Airflow - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Secrets Mastery in Airflow
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is the primary purpose of Airflow's secrets backend?

Airflow supports multiple secrets backends like HashiCorp Vault, AWS Secrets Manager, and environment variables. What is the main reason to use a secrets backend in Airflow?

ATo automatically generate logs for task failures.
BTo speed up DAG parsing by caching task metadata.
CTo securely store and retrieve sensitive information like passwords and API keys during task execution.
DTo schedule DAG runs based on secret expiration dates.
Attempts:
2 left
💡 Hint

Think about why you wouldn't want to hardcode passwords in your DAG files.

💻 Command Output
intermediate
1:30remaining
What is the output of this Airflow CLI command?

Given that Airflow is configured with the environment variables secrets backend, what will this command output?

Apache Airflow
airflow secrets get --conn-id my_postgres_conn
AEmpty output because secrets backends do not support CLI retrieval
BA JSON object with all connection details printed to the console
CSyntaxError: invalid command usage
DConnection URI string stored in the environment variable AIRFLOW_CONN_MY_POSTGRES_CONN
Attempts:
2 left
💡 Hint

Check how Airflow environment variable secrets are named and accessed.

Configuration
advanced
2:00remaining
Which configuration snippet correctly enables HashiCorp Vault as Airflow's secrets backend?

Choose the correct airflow.cfg snippet to configure HashiCorp Vault as the secrets backend with the Vault URL at https://vault.example.com and token authentication.

A
[secrets]
backend = airflow.providers.hashicorp.vault.VaultBackend
backend_kwargs = {"url": "vault.example.com", "auth": "token"}
B
[secrets]
backend = airflow.providers.hashicorp.secrets.vault.VaultBackend
backend_kwargs = {"url": "https://vault.example.com", "token": "mytoken"}
C
[secrets]
backend = airflow.secrets.vault.VaultBackend
backend_kwargs = {"url": "https://vault.example.com", "token": "mytoken"}
D
[secrets]
backend = airflow.providers.hashicorp.secrets.vault.VaultBackend
backend_kwargs = {"endpoint": "https://vault.example.com", "token": "mytoken"}
Attempts:
2 left
💡 Hint

Check the exact import path and parameter names for VaultBackend in Airflow providers.

Troubleshoot
advanced
2:00remaining
Why does Airflow fail to retrieve secrets from AWS Secrets Manager?

An Airflow deployment uses AWS Secrets Manager as the secrets backend. The DAGs fail with errors saying secrets are missing. Which of these is the most likely cause?

AThe IAM role or user running Airflow lacks permissions to read secrets from AWS Secrets Manager.
BThe secrets backend is not supported by Airflow and must be disabled.
CThe secrets are stored in AWS S3 instead of AWS Secrets Manager.
DAirflow requires secrets to be stored only in environment variables.
Attempts:
2 left
💡 Hint

Think about AWS permissions needed for Airflow to access secrets.

🔀 Workflow
expert
2:30remaining
What is the correct order to securely use secrets in an Airflow DAG?

Arrange these steps in the correct order to securely use a database password stored in a secrets backend within an Airflow DAG.

A1,2,3,4
B2,1,3,4
C1,3,2,4
D3,1,2,4
Attempts:
2 left
💡 Hint

Think about what must exist before Airflow can retrieve secrets and how tasks use them.