question

johnjohn-0472 avatar image
0 Votes"
johnjohn-0472 asked Jerryzy edited

How i can store the Remote Event Receicer's ClientSecret inside Azure Key Valut

I have a remote event receiver and i am storing the ClientID & the ClientSecret inside the web.config as follow:-

   <appSettings>
     <add key="ClientId" value="3**8" />
     <add key="ClientSecret" value="t**=" />
   </appSettings>

now i want to store the ClientSecret inside Azure key value instead of been stored as a plain text inside the web.config.. i did the following steps:-

Inside Azure Key Vault >> i create a new entity, as follow:-

91357-v1.png

then inside the created key valut >> i added a new secret and i define the ClientSecret as its value, as follow:-

91359-secrets.png

but i am not sure how i can access the Secret value inside my web.config?


azure-key-vault
v1.png (42.6 KiB)
secrets.png (18.8 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

trevorseward avatar image
0 Votes"
trevorseward answered johnjohn-0472 commented

You would no longer reference the AppId/Secret from the web.config but instead use Azure KeyVault .NET methods.

If hosting this in an Azure App Service, use the Managed Identity of the app to access KV -- this method increases security as you should not be placing any form of connection string to KV within your App Services' configuration.

If you're not using App Service or otherwise can't leverage Managed Identities, the fallback would be to use Certificate authentication to the KV.

https://docs.microsoft.com/en-us/dotnet/api/overview/azure/key-vault

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@trevorseward yes i am hosting the remote event recievers inside azure web app

0 Votes 0 ·