Bootstrap FreeKB - Hashicorp Vault - List Roles using the REST API
Hashicorp Vault - List Roles using the REST API

Updated:   |  Hashicorp Vault articles

This assumes the following has already been done.

Policies list what can and cannot be done. For example, to allow or not allow a user to create a secret.

A role contains one or more policies. Let's say you have enabled approle.

A LIST request to the /v1/auth/approle/role endpoint (this article) can be used to list the roles you have created.

When you initialized the vault a root token should have been returned, something like hvs.vND8VRSjt7pM7YvkIqECbAZY. The root token can be used in the LIST requests.

curl --header "X-Vault-Token: hvs.vND8VRSjt7pM7YvkIqECbAZY" --request LIST --url http://vault.example.com:8200/v1/auth/approle/role

 

Something like this should be returned.

{
    "request_id": "a0067c32-b1a6-a14d-30fe-f76b2f118eeb",
    "lease_id": "",
    "renewable": false,
    "lease_duration": 0,
    "data": {
        "keys": [
            "my-role"
        ]
    },
    "wrap_info": null,
    "warnings": null,
    "auth": null
}

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 0e11ed in the box below so that we can be sure you are a human.