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
    • Overview
      • Create a Deployment
      • Execution mode
      • Worker queues
      • Environment variables
      • Secrets backend
        • AWS Secrets Manager
        • AWS Systems Manager (SSM) Parameter Store
        • Azure Key Vault
        • HashiCorp Vault
        • Google Cloud Secret Manager
    • Book Office Hours

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: Create an Airflow variable or connection in Vault
  • Step 3: Set up Vault locally
  • (Optional) Authenticate to Vault with AWS Assume Role (STS)
  • Step 4: Deploy configuration
Manage DeploymentsSecrets backend

Set up HashiCorp Vault as your secrets backend

Edit this page
Built with

This page provides steps for using HashiCorp Vault as a secrets backend for both local development and on Astro.

To do this, you will:

  • Create an AppRole in Vault which grants Astro 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.

If you use a different secrets backend tool or want to learn the general approach on how to integrate one, see Configure a Secrets Backend.

Prerequisites

  • A Deployment on Astro.
  • The Astro CLI.
  • A local or hosted Vault server. See Starting the Server or Create a Vault Cluster on HCP.
  • An Astro project.
  • The Vault CLI.
  • Your Vault Server’s URL. If you’re using a local server, this should be http://127.0.0.1:8200/.
  • (Remote Execution Only) Helm installed
  • (Remote Execution Only) The values.yaml file from the Register Agents modal in your Deployments>Agents page.

If you don’t 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. For Remote Execution Deployments, you can use any Vault authentication method you prefer, for example Kubernetes auth if your agents and Vault are running on Kubernetes.

To do this:

  1. Run the following command to create a Vault policy that Astro can use to access a Vault server:

    1vault auth enable approle
    2vault policy write astro_policy - <<EOF
    3path "secret/*" {
    4 capabilities = ["create", "read", "update", "patch", "delete", "list"]
    5}
    6EOF
  2. Run the following command to create a Vault AppRole:

    1vault auth enable approle
    2vault write auth/approle/role/astro_role \
    3 role_id=astro_role \
    4 secret_id_ttl=0 \
    5 secret_id_num_uses=0 \
    6 token_num_uses=0 \
    7 token_ttl=24h \
    8 token_max_ttl=24h \
    9 token_policies=astro_policy
  3. Run the following command to retrieve the secret-id for your AppRole:

    $vault write -f auth/approle/role/<your-approle>/secret-id

    Save this value. You’ll use this later to complete the setup.

Step 2: Create an Airflow variable or connection in Vault

To start, create an Airflow variable or connection in Vault that you want to store as a secret. It can be either a real or test value. You will use this secret to test your backend’s functionality.

You can use an existing mount point or create a new one to store your Airflow connections and variables. For example, to create a new mount point called airflow, run the following Vault CLI command:

$vault secrets enable -path=airflow -version=2 kv

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

$vault kv put -mount=airflow variables/<your-variable-name> value=<your-value>

To store an Airflow connection in Vault as a secret at the path connections, first format the connection as a URI. Then, run the following Vault CLI command with your own values:

$vault kv put -mount=airflow connections/<your-connection-name> conn_uri=<connection-type>://<connection-login>:<connection-password>@<connection-host>:<connection-port>

To format existing connections in URI format, see Import and export connections.

Don’t use custom key names for your secrets. Airflow requires the key name value for all Airflow variables and the key name conn_uri for all Airflow connections as shown in the previous commands.

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

$# For variables
$$ vault kv get -mount=airflow variables/<your-variable-name>
$
$# For connections
$$ vault kv get -mount=airflow connections/<your-connection-name>

Step 3: Set up Vault locally

Astro
Remote Execution

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 .env file:

$AIRFLOW__SECRETS__BACKEND=airflow.providers.hashicorp.secrets.vault.VaultBackend
$AIRFLOW__SECRETS__BACKEND_KWARGS={"connections_path": "connections", "variables_path": "variables", "mount_point": "airflow", "url": "http://host.docker.internal:8200", "auth_type": "approle", "role_id":"astro_role", "secret_id":"<your-approle-secret>"}

If you run Vault on HashiCorp Cloud Platform (HCP):

  • Replace http://host.docker.internal:8200 with https://<your-cluster>.hashicorp.cloud:8200.
  • Add "namespace": "admin" as an argument after url.

This tells Airflow to look for variable and connection information at the airflow/variables/* and airflow/connections/* paths in your Vault server. You can now run a Dag locally to check that your variables are accessible using Variable.get("<your-variable-key>").

(Optional) Authenticate to Vault with AWS Assume Role (STS)

If your Astro environment runs in AWS, you can authenticate to Vault using AWS IAM with an STS assume role instead of an AppRole. This lets Vault verify the assumed AWS IAM role rather than requiring you to manage a long-lived AppRole secret. For more details, see Vault authentication with AWS Assume Role STS in the Apache Airflow documentation.

To use this authentication method, set auth_type to aws_iam and provide assume_role_kwargs with the IAM role to assume. For example:

$AIRFLOW__SECRETS__BACKEND=airflow.providers.hashicorp.secrets.vault.VaultBackend
$AIRFLOW__SECRETS__BACKEND_KWARGS={"connections_path": "connections", "variables_path": "variables", "mount_point": "airflow", "url": "<your-hashicorpvault-url>", "auth_type": "aws_iam", "assume_role_kwargs": {"RoleArn": "arn:aws:iam::<account-id>:role/<role-name>", "RoleSessionName": "Airflow"}}

For the full list of supported parameters in assume_role_kwargs, see the AWS STS assume_role reference.

Step 4: Deploy configuration

Astro
Remote Execution
  1. Run the following commands to export your environment variables to Astro:

    $astro deployment variable create --deployment-id <your-deployment-id> AIRFLOW__SECRETS__BACKEND=airflow.providers.hashicorp.secrets.vault.VaultBackend
    $
    $astro deployment variable create --deployment-id <your-deployment-id> AIRFLOW__SECRETS__BACKEND_KWARGS='{"connections_path": "connections", "variables_path": "variables", "mount_point": "airflow", "url": "<your-hashicorpvault-url>", "auth_type": "approle", "role_id":"astro_role", "secret_id":"<your-approle-secret>"}' --secret
  2. Run the following command to push your updated requirements.txt file to Astro:

    $astro deploy --deployment-id <your-deployment-id>
  3. (Optional) Remove the environment variables from your .env file or store your .env file in a safe location to protect your credentials in AIRFLOW__SECRETS__BACKEND_KWARGS.

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.