On my App Service i have several KeyVaults pinting to diferents URL's. I create a layer on App Configuration that depending if the Label point to Dev-DB, QA-DB, o Stage-DB Change the database of the App Service.
All my app services have on Environment variables, inside Connection strings all the diferent databases.
Inside of the Value i have this:
"@Microsoft.KeyVault(SecretUri=https://{MyKeyvault}.vault.azure.net/secrets/{MyVariable}/)+\"Application Name={UserOfDB};\"",
And i want to use somthing like this:
"@Microsoft.AppConfiguration(https://{MyAppConfig}.azconfig.net;Id={IdConfig};Secret={MySecret};Key={MyVariable};Label=${MyEnviromentVariable}) + \"Application Name={UserOfDB};\"",
But it gave me this error:
Identity: System assigned managed identity Status: InvalidSyntax Error details: Reference was not able to be resolved because invalid reference syntax found.
I just need a way to easy switch between Databases without losing my mind in the process.
is it posible to access Azure App Configuration via URL or conected some how as enviroment setting of App Service?
Yes, it is possible to access the App Configuration keys as @Microsoft.AppConfiguration
in the Azure App Service Environment Variables.
Check the below work around to add key as AppConfiguration reference in App Service:
In App Configuration
, add new keys with Key-Value and Key Vault reference.
I have created 2 keys with each 1 option.
Import/export
option to export the keys to the required Target(I have selected App Service).Export as reference
and click on Apply.@Microsoft.AppConfiguration(Endpoint=https://harshuappconfig.azconfig.io; Key=SampleKey)
Endpoint key is missing in your reference.
Initially I got the below error.
MSINotEnabled - Reference was not able to be resolved because site Managed Identity not enabled.
App Configuration reference was not resolved because site was denied access to the App Config store.
With Import/Export option, it is clear that adding Configuration settings with App Configuration reference is possible. But make sure you have enough permissions to access the App Configuration.