Skip to main content
HashiCorp Vault’s AppRole auth method enables machines and automated pipelines to authenticate securely using a predefined role. Each AppRole consists of:
  • A static Role ID (like a username).
  • One or more Secret IDs (like one-time passwords).
Combining Role ID + Secret ID grants a Vault token, similar to how users log in with username and password.
AppRole is ideal for non-interactive workloads (CI/CD pipelines, containers, VMs) that require short-lived credentials.

What Is AppRole?

AppRole is a secrets-engine authentication method in Vault. It’s commonly used when human interaction isn’t possible or desired. You:
  1. Enable the approle auth method.
  2. Create a role with policies, TTLs, and CIDR restrictions.
  3. Distribute the static Role ID and dynamically generate Secret IDs.

Authentication Workflow

  1. Vault Admin enables AppRole and creates a role (e.g., hcvop).
  2. Developer reads the static Role ID and bakes it into the container image.
  3. CI/CD pipeline requests a new Secret ID (optionally wrapped).
  4. Pipeline deploys the container, injecting Role ID + Secret ID.
  5. Application logs in and receives a Vault token.

Configuration Workflow

  1. Enable the AppRole auth method at a path (default or custom).
  2. Create a role with policies, TTL settings, and CIDR restrictions.
  3. Read the constant Role ID.
  4. Generate a unique Secret ID at deployment time.

Why Use AppRole for a Fleet of Web Servers?

Multiple instances share the same Role ID but each receives a unique Secret ID. This approach:
  • Prevents credential sharing between workloads.
  • Enables single-workload revocation and auditing.

AppRole Configuration Tips

Use the table below to tune your AppRole role:

Step-by-Step Guide

1. Enable the AppRole Auth Method

2. Create a Role

3. View Role Configuration

Sample output:

4. Retrieve the Role ID

5. Generate a Secret ID

secret_id is sensitive. Store or wrap it securely and avoid long-lived exposure.

6. Authenticate with AppRole (CLI)

Sample response:

7. Authenticate with AppRole (HTTP API)

Sample JSON:
Extract only the token:

That concludes the AppRole auth method guide. For human-centric authentication, explore the Userpass auth method.

Watch Video