Key Concepts
Path-Based Rules
Policies grant capabilities on specific paths. Use wildcards to match multiple paths.
Capabilities
Define allowed operations: create, read, update, delete, list, sudo, deny.
Deny by Default
Users have no access unless explicitly granted by a policy.
Multiple Policies
Users can have multiple policies. Permissions are additive (union of all policies).
Required Permissions
Capabilities Reference
How to Create a Policy
1
Select Vault Instance
Choose the target Vault instance from the dropdown if you have multiple.
2
Click Create Policy
Click the Create Policy button.
3
Enter Policy Name
Provide a unique, descriptive name:
- Use lowercase with hyphens (e.g.,
app-read-only) - Only alphanumeric, hyphens, and underscores allowed
4
Write Policy Rules
Define access rules in HCL format. Click Insert Example to start with a template.
5
Create
Click Create Policy to save.
Policy Syntax
Policies use HCL (HashiCorp Configuration Language) syntax:Path Patterns
For KV v2 secrets engine, use
secret/data/* for reading/writing secrets and secret/metadata/* for listing and metadata operations.Common Policy Examples
Read-Only Policy
Application-Specific Policy
Team Lead Policy
Deny Specific Paths
How to Edit a Policy
1
Find the Policy
Use the search bar to locate the policy by name.
2
Click Edit
Click the edit (pencil) icon on the policy row.
3
Modify Rules
Update the HCL content in the editor.
4
Save
Click Update Policy to apply changes.
How to Delete a Policy
1
Find the Policy
Locate the policy in the list.
2
Click Delete
Click the trash icon on the policy row.
3
Confirm
Confirm the deletion. This action cannot be undone.
Best Practices
Naming Conventions
Principle of Least Privilege
Grant minimum necessary permissions:Use Comments
Document the purpose of each rule:Separate by Environment
Create environment-specific policies:Troubleshooting
Policy not taking effect
Policy not taking effect
- Users may need to log out and back in
- Token may be cached with old permissions
- Verify the policy is attached to the user/group
Permission denied errors
Permission denied errors
- Check the exact path being accessed matches policy
- For KV v2, ensure using
secret/data/prefix - Verify required capability is included
- Check for explicit
denyrules that may override
Cannot list secrets but can read
Cannot list secrets but can read
listcapability must be on themetadatapath- Add:
path "secret/metadata/*" { capabilities = ["list"] }
Syntax error when saving
Syntax error when saving
- Check for missing closing braces
} - Ensure capabilities are in array format
["read", "list"] - Verify no trailing commas in capability arrays
- Use the Insert Example button to compare syntax
Cannot delete policy
Cannot delete policy
- You need delete permission for Vault policies
- Built-in policies (root, default) cannot be deleted
- Check with administrator for policy management permissions
FAQ
What happens when a user has multiple policies?
What happens when a user has multiple policies?
Permissions are additive. If policy A grants read and policy B grants write, the user has both read and write access. However, explicit
deny always wins.Can I test a policy before applying?
Can I test a policy before applying?
Use the Vault CLI
vault token capabilities command to test what operations are allowed for a token on a specific path.What's the difference between secret/data and secret/metadata?
What's the difference between secret/data and secret/metadata?
For KV v2 secrets engine:
secret/data/*- Read/write actual secret valuessecret/metadata/*- List paths, read/write metadata, delete versions
Can policies reference environment variables?
Can policies reference environment variables?
No. Policies are static HCL documents. Use templated policies with Vault Enterprise, or create separate policies per environment.
How do I grant admin access?
How do I grant admin access?
For full administrative access, attach the
root policy. Use sparingly and prefer scoped policies for day-to-day operations.Are policy names case-sensitive?
Are policy names case-sensitive?
Yes.
MyPolicy and mypolicy are different policies. Use consistent lowercase naming.