I have a container app service running in azure and it works fine.
However if i want to run this container locally it fails because it cant authenticate to read the key vault in azure.
.ConfigureAppConfiguration((context, config) =>
{
var builtConfig = config.Build();
string SecretUri = $"https://{builtConfig["KeyVaultName"]}.vault.azure.net/";
var secretClient = new SecretClient(new Uri(SecretUri), new DefaultAzureCredential(new DefaultAzureCredentialOptions { ExcludeSharedTokenCacheCredential = true }));
config.AddAzureKeyVault(secretClient, new KeyVaultSecretManager());
})
When running in azure the DefaultAzureCredential will inherit its permissions from the app service and that works fine.
However if i want to run the container locally for testing outside of azure it doesnt know what permissions to use. How should i handle this? Can i somehow tell the container what permissions to use without making dev changes to the container?