For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
      • AstroFully-managed data operations, powered by Apache Airflow.
      • Astro Private CloudRun Airflow-as-a-service in your environment.
      • Professional ServicesExpert Airflow services for your enterprise's success.
    • Tools
      • Cosmos
      • Orbiter
      • CLI
      • AI SDK
      • Agents
      • Blueprint
      • UpdatesThe State of Airflow 2026See the insights from over 5,800 data practitioners in the full report. Download Now ➔
  • Customers
  • Docs
    • Insights
      • Blog
      • Webinars
      • Resource Library
      • Events
    • Education
      • Academy
      • What is Airflow?
  • Pricing
Get Started Free
    • Astro Private Cloud overview
    • Astro Private Cloud features
      • Configure a secrets backend
        • Hashicorp Vault
        • AWS Secrets Manager
        • AWS Parameter Store
        • Google Cloud Secret Manager
        • Azure Key Vault
      • Configure Kerberos database authentication
      • Third-party ingress controllers
      • Network configuration
      • Bring your own service accounts
      • Configure security contexts
      • Read-only root filesystem
      • TLS certificate management
    • Release and lifecycle policy
    • Support policy

Product

  • Platform Overview
  • Astro
  • Astro Observe
  • Astro Private Cloud
  • Security & Trust
  • Pricing

Tools & Services

  • Cosmos
  • Docs
  • Professional Services
  • Product Updates

Use Cases

  • AI Ops
  • Data Observability
  • ETL/ELT
  • ML Ops
  • Operational Analytics
  • All Use Cases

Industries

  • Financial Services
  • Gaming
  • Retail
  • Manufacturing
  • Healthcare
  • All Industries

Resources

  • Academy
  • eBooks & Guides
  • Blog
  • Webinars
  • Events
  • The Data Flowcast Podcast
  • All Resources

Airflow

  • What is Airflow
  • Airflow on Astro
  • Airflow 3.0
  • Airflow Upgrades
  • Airflow Use Cases
  • Airflow 2.x End of Life

Company

  • Our Story
  • Customers
  • Newsroom
  • Careers
  • Contact

Support

  • Knowledge Base
  • Status
  • Contact Support
GitHubYouTubeLinkedInx
  • Legal
  • Privacy
  • Terms of Service
  • Consent Preferences

  • Do Not Sell or Share My Personal information
  • Limit the Use Of My Sensitive Personal Information

Apache Airflow®, Airflow, and the Airflow logo are trademarks of the Apache Software Foundation. Copyright © Astronomer 2026. All rights reserved.

LogoLogo
On this page
  • Prerequisites
  • Step 1: Create a Policy and AppRole in Vault
  • Step 2: Write an Airflow variable or connection to Vault
  • Step 3: Set up Vault locally
  • Step 4: Run an example Dag to test Vault locally
  • Step 5: Deploy on Astro Private Cloud
Security and complianceConfigure a secrets backend

Configure a Hashicorp Vault secrets backend on Astro Private Cloud

Edit this page
Built with

In this section, you’ll learn how to use Hashicorp Vault as a secrets backend for both local development and on Astro Private Cloud. To do this, you will:

  • Create an AppRole in Vault which grants Astronomer minimal required permissions.
  • Write a test Airflow variable or connection as a secret to your Vault server.
  • Configure your Astro project to pull the secret from Vault.
  • Test the backend in a local environment.
  • Deploy your changes to Astro Private Cloud.

Prerequisites

  • A Deployment on Astronomer.
  • The Astro CLI.
  • A Hashicorp Vault server.
  • An Astro project initialized with astro dev init.
  • The Vault CLI.
  • Your Vault Server’s URL. If you’re using a local server, this should be http://127.0.0.1:8200/.

If you do not already have a Vault server deployed but would like to test this feature, Astronomer recommends that you either:

  • Sign up for a Vault trial on Hashicorp Cloud Platform (HCP) or
  • Deploy a local Vault server. See Starting the server in Hashicorp documentation.

Step 1: Create a Policy and AppRole in Vault

To use Vault as a secrets backend, Astronomer recommends configuring a Vault AppRole with a policy that grants only the minimum necessary permissions for Astro Private Cloud. To do this:

  1. Create a Vault policy with the following permissions:

    1path "secret/data/variables/*" {
    2 capabilities = ["read", "list"]
    3}
    4
    5path "secret/data/connections/*" {
    6 capabilities = ["read", "list"]
    7}
  2. Create a Vault AppRole and attach the policy you just created to it.

  3. Retrieve the role-id and secret-id for your AppRole by running the following commands:

    1vault read auth/approle/role/<your-approle>/role-id
    2vault write -f auth/approle/role/<your-approle>/secret-id

    Save these values for Step 3.

Step 2: Write an Airflow variable or connection to Vault

To test whether your Vault server is set up properly, create a test Airflow variable or connection to store as a secret.

To store an Airflow variable in Vault as a secret, run the following Vault CLI command with your own values:

1vault kv put secret/variables/<your-variable-key> value=<your-variable-value>

To store a connection in Vault as a secret, run the following Vault CLI command with your own values:

1vault kv put secret/connections/<your-connection-id> conn_uri=<connection-type>://<connection-login>:<connection-password>@<connection-host>:5432

To confirm that your secret was written to Vault successfully, run:

1# For variables
2$ vault kv get secret/variables/<your-variable-key>
3# For connections
4$ vault kv get secret/connections/<your-connection-id>

Step 3: Set up Vault locally

In your Astro project, add the Hashicorp Airflow provider to your project by adding the following to your requirements.txt file:

apache-airflow-providers-hashicorp

Then, add the following environment variables to your Dockerfile:

1# Make sure to replace `<your-approle-id>` and `<your-approle-secret>` with your own values.
2ENV AIRFLOW__SECRETS__BACKEND=airflow.providers.hashicorp.secrets.vault.VaultBackend
3ENV AIRFLOW__SECRETS__BACKEND_KWARGS={"connections_path": "connections", "variables_path": "variables", "config_path": null, "url": "http://host.docker.internal:8200", "auth_type": "approle", "role_id":"<your-approle-id>", "secret_id":"<your-approle-secret>"}

This tells Airflow to look for variable and connection information at the secret/variables/* and secret/connections/* paths in your Vault server. In the next step, you’ll test this configuration in a local Airflow environment.

If you want to deploy your project to a hosted Git repository before deploying to Astro Private Cloud, be sure to save <your-approle-id> and <your-approle-secret> securely. Astronomer recommends adding them to your project’s .env file and specifying this file in .gitignore.

When you deploy to Astro Private Cloud in Step 4, you can set these values as secrets in the UI.

By default, Airflow uses "kv_engine_version": 2, but this secret was written using v1. You can change this to accommodate how you write and read your secrets.

For more information on the Airflow provider for Hashicorp Vault and how to further customize your integration, see the Apache Airflow documentation.

Step 4: Run an example Dag to test Vault locally

To test Vault, write a simple Dag which calls your test secret and add this Dag to your project’s dags directory. For example, you can use the following Dag to print the value of a variable to your task logs:

1from airflow import DAG
2from airflow.hooks.base import BaseHook
3from airflow.models import Variable
4from airflow.operators.python import PythonOperator
5from datetime import datetime
6
7def print_var():
8 my_var = Variable.get("<your-variable-key>")
9 print(f'My variable is: {my_var}')
10
11with DAG('example_secrets_dags', start_date=datetime(2022, 1, 1), schedule=None) as dag:
12
13 test_task = PythonOperator(
14 task_id='test-task',
15 python_callable=print_var,
16)

Once you’ve added this Dag to your project:

  1. Run astro dev restart to push your changes to your local Airflow environment.

  2. In the Airflow UI (http://localhost:8080/admin/), trigger your new dag.

  3. Click on test-task > View Logs. If you ran the example Dag above, you should see the contents of your secret in the task logs:

    {logging_mixin.py:109} INFO - My variable is: my-test-variable

Once you confirm that the setup was successful, you can delete this example dag.

Step 5: Deploy on Astro Private Cloud

Once you’ve confirmed that the integration with Vault works locally, you can complete a similar set up with a Deployment on Astro Private Cloud.

  1. In the Astro Private Cloud UI, add the same environment variables found in your Dockerfile to your Deployment environment variables. Specify AIRFLOW__SECRETS__BACKEND_KWARGS as secret to ensure that your Vault credentials are stored securely.
  2. In your Astro project, delete the environment variables from your Dockerfile.
  3. Deploy your changes to Astro Private Cloud.

Now, any Airflow variable or connection that you write to your Vault server can be successfully accessed and pulled by any Dag in your Deployment on Astro Private Cloud.