Reputation: 3
I was trying to set following env variable. But I wanted to do so with api if possible. I couldn't find anything, just wanted to make sure if I can.
AZURE_CLIENT_ID - service principal's app id AZURE_TENANT_ID - id of the principal's Azure Active Directory tenant AZURE_CLIENT_SECRET - one of the service principal's client secrets
Upvotes: 0
Views: 1313
Reputation: 8254
As mentioned by @Vineesh Vijayan, you can use the Azure key vault which lets you retrieve key-value pairs. After creating the key vault resource, you can add your environment variables by Adding secret to Key Vault. Make sure you add the dependencies in pom.xml
.
And now you can retrieve the stored keys after Authenticating your key vault using the below line.
KeyVaultKey retrievedKey = keyClient.getKey(keyName);
In Case you trying to Get Secrets using rest API, you can use
GET {vaultBaseUrl}/secrets/{secret-name}/{secret-version}?api-version=7.3
REFERENCES: Azure Key Vault Secret client library for Java
Upvotes: 0