This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Tech Community.
If you want to know how to use it in C#/Java, there are some sample code in this document: https://docs.microsoft.com/en-us/azure/app-service/configure-ssl-certificate-in-code. Basically, to refer certificates uploaded in Azure App Service Linux using Python does not make much difference from in a local machine. It can be divided into three steps:
Steps:
1. Upload or import the certificates in Azure Portal to make it accessible to the app service:
2. Load certificate by setting WEBSITE_LOAD_CERTIFICATES to * or a specific thumbprint which belong to the certificate you want to use.
Then the certificate(s) will be injected into the python container in the path "/var/ssl/":
3. Refer to the certificate using Python Code.
Firstly, we can check if they exist by going to their directories in SSH:
Then leverage below sample code to use the certificate, replacing the thumbprint with yours:
Sample Code:
Sample1(using pyOpenSSL):
Output1:
Sample2(using cryptography):
Output2:
Note that those certificates are stored in format "p12" and their password is empty.
All done. Thanks for reading! I hope you have fun in it!