I have a client secret in the form of a private key that I want to store in an Azure key vault. My appsettings file contains the property to be read like so:
"MyConfiguration": {
"ClientSecret": "<secret>",
The secret looks like this:
{
"kty": "RSA",
"kid": "someKID",
"alg": "PS512",
"e": "AQAB",
"n": "lotsoftext",
"d": "lotsoftext",
"dp": "lotsoftext",
"dq": "lotsoftext",
"p": "lotsoftext",
"q": "lotsoftext",
"qi": "lotsoftext"
}
Previously the secret was stored locally in a private.jwk
file, but now is being moved to key vault. Locally everything works fine, even when reading from the key vault. The configration value gets set as expected. However in my dev environment in Azure, the API simply fails. The logs say that the application has started, and Swagger is available, but all endpoints return 500 with no additional logs. I have wrapped the section of Startup.cs
where the configuration is mapped in a try/catch with logging, but nothing gets logged at all.
My first thought was that something might be wrong with the formatting when uploading it to the key vault, but why would it work locally and not in Azure then, when using the exact same secret?
This secret is used for authentication, but even endpoints that do not require authentication return a 500.
Any ideas what might be wrong?