question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AppConfiguration not resolving key value references

See original GitHub issue

Describe the bug client.getConfigurationSetting does not resolve Key Vault references from App Configuration. I believe this is a feature which should be working, as per this .net tutorial https://docs.microsoft.com/en-us/azure/azure-app-configuration/use-key-vault-references-dotnet-core?tabs=cmd%2Ccore2x

To Reproduce Steps to reproduce the behaviour:

process.env.AZURE_TENANT_ID="valid value";
process.env.AZURE_CLIENT_ID="valid value";
process.env.AZURE_CLIENT_SECRET="valid value";

const { DefaultAzureCredential } = require('@azure/identity');
const { AppConfigurationClient } = require('@azure/app-configuration');

const url = `https://redacted.azconfig.io`;

const credential = new DefaultAzureCredential();
const client = new AppConfigurationClient(url, credential);

module.exports = async function() {

  for await (const secretProperties of client.listConfigurationSettings()) {
    const secret = await client.getConfigurationSetting({ key: secretProperties.key });
    console.log(secret.value);
  }

};

Expected behavior Key value value resolved, instead of the uri reference to vault. Currently above code would log

value: '{"uri":"https://redacted.vault.azure.net/secrets/example/redacted"}',

rather than the real value.

In the linked article, it mentions:

Because the client provider recognizes the keys as Key Vault references, it uses Key Vault to retrieve their values. to me, it seems like the SDK could be resolving the real values, however I might be misunderstanding that sentence

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
HarshaNallurucommented, Jun 17, 2021

Thanks, @my3sons. Feel free to log issues in https://github.com/Azure/azure-sdk-for-java repo. @mssfang can help with issues related to app-config java SDK.

1reaction
richardpark-msftcommented, Dec 18, 2020

Hi @iqfy-kyle,

Your intuition was right on this - the actual resolution of the key vault reference is done on the client side in the implementations that support them.

As an example, you can see how the .net configuration settings provider does it here, using just the AppConfig and KeyVault SDKs.

https://github.com/Azure/AppConfiguration-DotnetProvider/blob/956c4571a7654170c33cbf36450e6566d313acfa/src/Microsoft.Extensions.Configuration.AzureAppConfiguration/AzureKeyVaultReference/AzureKeyVaultKeyValueAdapter.cs#L53

It deserializes the Application Config setting, extracting the keyvault ref, and then uses a KeyVault client to retrieve the value.

Closing this issue for now, but please feel free to reopen if you feel like I didn’t answer your question or want to continue discussion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tutorial: Use Key Vault references in an ASP.NET Core app
Create an App Configuration key that references a value stored in Key Vault. Access the value of this key from an ASP.NET Core...
Read more >
"Key vault reference error" in azure web app configuration ...
I am now stuck with the following error: Key Vault reference was not able to be resolved because site was denied access to...
Read more >
Spring Cloud Azure App Configuration - Microsoft Open Source
Azure App Configuration and its client libraries support referencing secrets stored in Key Vault. In App Configuration, keys can be created which have...
Read more >
Using Key Vault references with Azure App Configuration
When working in Azure, storing secrets in Key Vault is a good idea. And to make it better, there's the Key Vault Reference...
Read more >
Using Key Vault references with Azure App Configuration
This feature makes sure no one can read the secret(s) unless someone grants permission. For storing configuration, values a different service is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found