Engineering: How to access uploaded certificates in Azure Web Sites

Posted by Nilay Parikh and last modified on Tue Jun 12, 2018.

Certificates in Azure Web Site works differently than on-premise or local IIS instance. The website would not have access to a certificate store, and mostly it uses in physical memory.

It is as easy and straightforward process,

  1. Upload certificate through Azure Portal.
  2. Add an AppSetting through Azure Portal (Key: WEBSITE_LOAD_CERTIFICATES) and set the value to the thumbprint of your uploaded certificate.

The above two step would be sufficient to get your certificates ready to be used in Application.

var myStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
myStore.Open(OpenFlags.ReadOnly);

var certificate = myStore.Certificates.Find(X509FindType.FindByThumbprint, YOUR_THUMBPRINT, false);

Note: To ensure validity you can change “false” to “true” in above Certificates.Find

You can also refer Using Certificates in Azure Websites Applications

Disclaimer

Any views or opinions expressed are solely those of the author and do not represent any other person or organisation. THE ARTICLE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. IN NO EVENT SHALL THE AUTHOR(S) OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY.

References