App Service with Key Mapping Error

App Service with Key Mapping Error header image

Sometimes you encounter weird errors 🐜. In a recent scenario a customer I have been involved for quite a while had issues with their App Service. This App service runs an application and have been doing so for over seven years, without any noticeable errors. Right upon now.

No valid Key Mapping found for securitytoken

When we hit the page we got a full blown application error: No valid key mapping found for securityToken. The confusing part was that it all seems okay. No changes where made to the application or settings. And the secrets where not expired..

Searching of the error points towards stackoverflow and msdn but that all seemed a bit outdated and didn’t explain what happened.

Then it dawned on me, in our App Start we wired up our DatabaseIssuerNameRegistry with an app setting. That contains some certificate information, and those are rolled over automatically in Azure. Since the App then is still started it keeps referencing the old info, resulting in throwing the error.

App Service No valid Key Mapping found for security token

So the quick fix was to restart the App Service to make sure it retrieves all the app settings again. So it looks like the old saying is still true; have you tried turning it off and on again? A bit bummed that it took me a few hours to debug everything and figure out what happened, but hey in the end it made sense.

Loading comments…