So I am now getting the error when attempting to run this configuration set in my program.cs file:
var keyVaultConfigBuilder = new ConfigurationBuilder();
//Check these worked and they do for what I have
var vault = builtConfig["Azure:Vault"];
var clientId = builtConfig["Azure:ClientId"];
var clientSecret = builtConfig["Azure:ClientSecret"];
keyVaultConfigBuilder.AddAzureKeyVault(
$"https://{builtConfig["Azure:Vault"]}.vault.azure.net/",
builtConfig["Azure:ClientId"],
builtConfig["Azure:ClientSecret"]);
//Fails here on building where it succeeded yesterday
var keyVaultConfig = keyVaultConfigBuilder.Build();
And in my appsettings.json (sectionof)
"Azure": {
"Vault": "Expenses",
"ClientId": "(guid for my applicationId)",
"ClientSecret": "(base64 encoded key that never expires)"
},
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
However just the other day I got it working completely and it was working just fine. I can go to this uri:
https://Expenses.vault.azure.net
And see I get a 403 forbidden which means it least it can be reached. Things I have tried:
- Creating a brand new application registration and trying that.
- Restarted Visual Studio
- Removed 'Access Policies' under Key Vault and attempted to add them back again.
- Checked that Firewalls on KeyVault was set to all networks.
When I had it working the other day I was trying lots of things and hooked up a powershell command where I had hooked up remote access to my subscription. Could this need to be set in the application first before hitting the domain of my key vault? I don't know. I just want it to work with the key vault with minimal effort from a .NET Core API 2.1 application.