The data protection operation was unsuccessful on Azure using OWIN / Katana The data protection operation was unsuccessful on Azure using OWIN / Katana azure azure

The data protection operation was unsuccessful on Azure using OWIN / Katana


If the host server is a virtual machine it could be exactly what the error message says. Check if your Application Pool in IIS really has Load User Profile set to true like the exception says:

  • In the Connections pane, expand the server name, and then click Application Pools.
  • Right click on you Pool
  • Advanced Settings

enter image description here


I have the same problem when I try to generate token with ASP .Net identity and custom login function in Web API.

"The data protection operation was unsuccessful. This may have been caused by not having the user profile loaded for the current thread's user context, which may be the case when the thread is impersonating."

What I did is just simply create an Application Setting called WEBSITE_LOAD_USER_PROFILE in Microsoft Azure and set it to 1. That solution works for me.

You can see the detail here


Please see my my answer to this question. A much simpler solution can be achieved by utilizing IAppBuilder.GetDataProtectionProvider()