- A static Role ID (like a username).
- One or more Secret IDs (like one-time passwords).
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:- Enable the
approleauth method. - Create a role with policies, TTLs, and CIDR restrictions.
- Distribute the static Role ID and dynamically generate Secret IDs.
Authentication Workflow
- Vault Admin enables AppRole and creates a role (e.g.,
hcvop). - Developer reads the static Role ID and bakes it into the container image.
- CI/CD pipeline requests a new Secret ID (optionally wrapped).
- Pipeline deploys the container, injecting Role ID + Secret ID.
- Application logs in and receives a Vault token.
Configuration Workflow
- Enable the AppRole auth method at a path (default or custom).
- Create a role with policies, TTL settings, and CIDR restrictions.
- Read the constant Role ID.
- 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:| Parameter | Description |
|---|---|
| token_policies | Vault policies attached to the generated token (e.g., web-app). |
| token_ttl | Default TTL for tokens issued under this role (e.g., 1h). |
| token_max_ttl | Maximum TTL users can renew tokens to (e.g., 24h). |
| secret_id_ttl | Time-to-live for unused Secret IDs to limit exposure. |
| token_bound_cidrs | List of CIDR blocks from which the token is valid (e.g., 10.1.16.0/16). |
| token_type | Token type (service or batch). Batch tokens cannot be renewed. |
Step-by-Step Guide
1. Enable the AppRole Auth Method
2. Create a Role
3. View Role Configuration
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)
7. Authenticate with AppRole (HTTP API)
That concludes the AppRole auth method guide. For human-centric authentication, explore the Userpass auth method.