lr_azure_kv_get_secret

Fetches a secret value from Microsoft Azure Key Vault.

C Language

int lr_azure_kv_get_secret("param1=value1","param2=value2",LAST);

Arguments

NameComments
ResultParamNameName of the parameter which is used to save the secret.
VaultURLVault URL of the Azure Key Vault.
SecretNameName of the secret.
SecretVersion(Optional) Version of the secret. If this is not set, the function fetches the value of the latest version.
TokenToken for authentication.

Return Values

C Language: Returns 0 on success, or 1 for an error.

Parameterization

All string input arguments can be passed using standard parameterization.

Example

Copy code
Action ()
{
    int   rc;
    rc = lr_azure_set_service_port(16888);

    rc = lr_azure_ad_client_get_token("ResultParamName=token1",
                                       "TenantID=xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
                                       "ClientID=xxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxx",
                                       "ClientSecret=xxxxxxxxxxxxxxxx", LAST);
    

        lr_output_message("token value is %s",lr_eval_string("{token1}"));

    rc = lr_azure_kv_get_secret("ResultParamName=secret1",
                                 "VaultURL=https://xxxxkeyvtest.vault.azure.net",
                                 "SecretName=ProductSecret",
                                 "Token={token1}", LAST);
    
       lr_output_message("secret1 value is %s",lr_eval_string("{secret1}"));

}