Data Protection Keys Not Persisted To Azure

Viewed 3017

I have an ASP.NET Core application hosted in IIS in an Azure VM. I call the extension method to persist they key to Azure but nothing is ever stored there and the application seems to still be using local keys. I followed the example here: http://intellitect.com/staying-logged-across-azure-app-service-swap/ exactly. As a matter of fact, when I test the code in a console application, persistence works fine. However, when I run the ASP.NET Core app with this code, nothing ever gets persisted to Azure. Any ideas why?

3 Answers

The marked answer helped me to debug the issue I was having with keys not being persisted to blob storage.

In my case it was the lack of a root element in the existing blob/xml.

If there is an existing blob that is being referenced, it must contain the following content in order for the data protection library to populate it with the keys upon lazy initialisation:

<?xml version="1.0" encoding="utf-8"?><repository></repository>

The documentation doesn't mention this.

Related