lr_hashicorp_vault_get_secret_with_approle_auth

Retrieves the full secret response from HashiCorp Vault using AppRole authorization, and stores it in a parameter.

Arguments

NameComments
ServerUrlThe URL of the HashiCorp Vault server, e.g. “http://127.0.0.1:8200”
SecretPathThe path to the secret within the Vault, e.g. “secret/mysecret”. If KV version 2, “data/” must be added in the path.
KvVersionThe KV version used in vault, the value can be “1” or “2”.
SecretVersionThe version of the secret to retrieve e.g. “1”. If empty, the latest version is returned. For KV version 1, this argument is ignored as versioning was not supported.
RoleIdThe Role ID associated with the AppRole, e.g. “9f8e2c4a-d112-4bfc-9db1-d912f7f34567”
SecretIdThe Secret ID tied to the AppRole for authentication, e.g. “7a6b43b7-d26e-4a35-8f8a-bf81c7c74280”
VaultNamespaceThe Vault namespace to use, e.g. “admin”. Leave this empty if no vault namespace is used.
ResultParamNameThe name of the parameter in which the response will be stored.

Return Values

Returns 0 on success, or 1 for an error.

Parameterization

All string input arguments can be passed using standard parameterization.

Examples

C language - KV Version 1

Copy code
lr_hashicorp_vault_get_secret_with_approle_auth ("ServerUrl=http://127.0.0.1:8200",
              "SecretPath=secret/mysecret",
              "KvVersion=1",
              "SecretVersion=",
              "RoleId=9f8e2c4a-d112-4bfc-9db1-d912f7f34567",
              "SecretId=7a6b43b7-d26e-4a35-8f8a-bf81c7c74280", 
              "VaultNamespace=admin",
              "ResultParamName=response",
              LAST);

C language - KV Version 2

Copy code
lr_hashicorp_vault_get_secret_with_approle_auth ("ServerUrl=http://127.0.0.1:8200",
              "SecretPath=secret/data/mysecret",
              "KvVersion=2",
              "SecretVersion=1",
              "RoleId=9f8e2c4a-d112-4bfc-9db1-d912f7f34567",
              "SecretId=7a6b43b7-d26e-4a35-8f8a-bf81c7c74280", 
              "VaultNamespace=admin",
              "ResultParamName=response",
              LAST);

Java and .NET

Copy code
lr.hashicorp_vault_get_secret_with_approle_auth (new String[] {
              "ServerUrl=http://127.0.0.1:8200",
              "SecretPath=secret/data/mysecret",
              "KvVersion=2",
              "SecretVersion=1",
              "RoleId=9f8e2c4a-d112-4bfc-9db1-d912f7f34567",
              "SecretId=7a6b43b7-d26e-4a35-8f8a-bf81c7c74280", 
              "VaultNamespace=admin",
              "ResultParamName=response"});

JavaScript

Copy code
lr.hashicorpVaultGetSecretWithApproleAuth({serverUrl:"http://127.0.0.1:8200",
              secretPath:"secret/data/mysecret",
              kvVersion:"2",
              secretVersion:"1",
              roleId:"9f8e2c4a-d112-4bfc-9db1-d912f7f34567",
              secretId:"7a6b43b7-d26e-4a35-8f8a-bf81c7c74280"
              vaultNamespace:"admin",
              resultParamName:"response"});