Share via

DataProtectionConfigurationProvider not working on my Azure app service

Nathanael Omnes 21 Reputation points
2021-02-15T21:50:21.963+00:00

Hey!

I am trying to encrypt my connection string data in my App.config files of my project.
I found this topic, the solution is basically, I give my connection string -> it encrypts it -> I put the given encrypted string into my App.config and bam. It works (normally).

This is what the encrypted string looks like:

<connectionStrings configProtectionProvider="DataProtectionConfigurationProvider"> <EncryptedData> <CipherData> <CipherValue>AQAAANCMnd...</CipherValue> </CipherData> </EncryptedData> </connectionStrings>

The solution works on my local solution, I have access to my DB without any problem.
However, when I upload the project to my Azure app service, the database isn't reached. I'm sure it's because of the encrypted data but I don't know why (the db connection works without the encryption).

So if you have an idea, you are my only hope. I would like to keep the encryption simple, I found a lot of other solutions but I find them pretty complicated to make it work.

Thanks by advance!

Azure SQL Database
Azure App Service
Azure App Service

Azure App Service is a service used to create and deploy scalable, mission-critical web apps.

0 comments No comments

Answer accepted by question author

SnehaAgrawal-MSFT 22,721 Reputation points Moderator
2021-02-17T14:23:39.17+00:00

Thanks for asking question! I noticed your query on SO regarding DataProtectionConfigurationProvider not working on my Azure app service.
As mentioned by Json: Because of the particularity of the Azure Web AppService platform, so the C# config original encryption method of DataProtectionConfigurationProvider and RSAProtectedConfigurationProvider in the Azure platform is not available.
And DataProtectionConfigurationProvider cannot take effect in the traditional way of Azure web app. You can refer to the solution in the article for processing.

Reference: config file encryption method for Azure web site and web job

Disclaimer: This response contains a reference to a third-party World Wide Web site. Microsoft is providing this information as a convenience to you.

Let us know if you have further query.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.