When I inspect the value of config in Startup.cs it has definitely pulled in the connection string from the azure vault
However, when the build completes I get the blank umbraco environment you would get with a fresh install, so it's as if the connection string isn't registered.
Has anyone come across this? I wondered if it is anything to do with the naming convention? Ie in appsettings you'd normally have:
Usually in appsettings, the sections are separated with colons (:). Colons are not a valid character in keyvault keys though. I would expect your secret in keyvault to be named ConnectionStrings--umbracoDbDSN. The double dash should be replaced with colons and therefore work.
The article mentions the nesting of Azure Blob Storage setting names and how to set those in your secret but doesn't make clear the equivalent for UmbacoDbDSN string.
The default azure credentials is a collection of various different credentials.
How do you expect to be logged in? Is it through your Visual Studio account? Or perhaps with an environment variable? The error indicates that none of the possible options are configured.
AzureKeyVault and local builds
Hello, I've successfully connected my umbraco web app to its db in Azure using AzureKeyVault, following the great instructions here: https://docs.umbraco.com/umbraco-cms/extending/key-vault
However, I am having problems getting the solution to run locally when I remove the connection string value from AppSettings.json.
My Program.cs:
Then in appsettings I add:
When I inspect the value of config in Startup.cs it has definitely pulled in the connection string from the azure vault
However, when the build completes I get the blank umbraco environment you would get with a fresh install, so it's as if the connection string isn't registered.
Has anyone come across this? I wondered if it is anything to do with the naming convention? Ie in appsettings you'd normally have:
which gets read as ConnectionStrings.umbracoDbDSN
Heyo!
Usually in appsettings, the sections are separated with colons (:). Colons are not a valid character in keyvault keys though. I would expect your secret in keyvault to be named
ConnectionStrings--umbracoDbDSN
. The double dash should be replaced with colons and therefore work.For reference: https://stackoverflow.com/questions/68224000/using-keyvault-secrets-to-override-appsettings-in-azure-app-service-and-locally
Thanks so much Dennis, that worked first time #H5YR
If anyone from Umbraco Docs sees this it would be worth flagging this specifically in this otherwise excellent article: https://docs.umbraco.com/umbraco-cms/extending/key-vault
The article mentions the nesting of Azure Blob Storage setting names and how to set those in your secret but doesn't make clear the equivalent for UmbacoDbDSN string.
I've got the below issue when I try to load the site locally
"DefaultAzureCredential failed to retrieve a token from the included credentials.
Not sure what's causing it. Was wondering if anyone came across the same issue too.
Thanks
Hi Jay!
The default azure credentials is a collection of various different credentials.
How do you expect to be logged in? Is it through your Visual Studio account? Or perhaps with an environment variable? The error indicates that none of the possible options are configured.
Hi Jay, is the problem on your deployed App or when building locally.
Some extra steps for local development (sorry if you've already done this)
Ensure you have these packages
Follow these steps to set up local secrets in your IDE https://learn.microsoft.com/en-us/aspnet/core/security/key-vault-configuration?view=aspnetcore-7.0
You should see these under your web app:
In particular pay attention to the syntax when adding the connection string if it's nested in config (this killed me!), eg
And as Dennis said, make sure you're signed in in Visual Studio if your access is authorised by Active Directory or some other RBAC.
Hope some of that has helped
is working on a reply...