TLS/SSL settings cert in azure function App - azure

I was trying to see if the purpose of this TLS/SSL settings in function app is similar to the cert store? i.e. can we store a public cert in this section of the function app and let function app access the public cert in the code by getting the cert from this location? If yes, is there any sample that I can take a look into?

if the purpose of this TLS/SSL settings in function app is similar to
the cert store?
The purpose of this TLS/SSL settings in function app is not similar to the cert store.
A certificate uploaded into an app is stored in a deployment unit that is bound to the app service plan's resource group and region combination (internally called a webspace). This makes the certificate accessible to other apps in the same resource group and region combination.
If you are using cert store( key vault ) to store you ssl certificates then you need to pass the key vault certificate uri as application setting to the functions app.
can we store a public cert in this section of the function app and let
function app access the public cert in the code by getting the cert
from this location? If yes, is there any sample that I can take a look
into?
As per the Azure documentation , you can store the public cert under the function app ttl/ssl settings & refer this documentation for accessing the certificate in your application code.

Related

Azure static website use my own ssl certificate?

I have my own certificate that I want to use with azure static website(not web app, we use the one based on blob storage), but looks uploading my own certificate is not supported, is there any workaround or solution for this ?
Note : the static website is private with privatelink and the dns name is private (only used in internal network with our own dns server on premise)
In Azure Static web app We cannot bind our own certificates like as in Basic App Service. It provides it's own free certificate.
But we have a workaround here, through which You can bring your own certificate (I haven't tested it yet):-
First you need to set up Azure Front Door: https://learn.microsoft.com/en-us/azure/static-web-apps/front-door-manual
Then you need to configure SSL with your own certificate
Hope this helps!

Azure App Service and Certificate Authority

We are building an enterprise application which is hosted on Azure App Service. The app service calls an internal inventory service to retrieve data. As part of initial call to the inventory service, it requires us to pass the .cer certificate for the calls.
The company issues certificates and acts as a Certificate Authority.
Question : is it possible to trust the internal company as a Certificate Authority in App service, so that, the app services trusts calls from the internal services.
This will be of huge help, because the certificate issues by the internal company CA expire each year and we will need to re-upload a valid certificate each time.
Any help will be much appreciated.
Unfortunately, you cannot add a certificate to the trusted certificate authority on an Azure Web App. The security implications would be quite bad.
To use a certificate in App Service, the certificate must meet all the following requirements:
• Signed by a trusted certificate authority
• Exported as a password-protected PFX file
• Contains private key at least 2048 bits long
• Contains all intermediate certificates in the certificate chain
Below Links will help you in configuring certificates in app service if you are not looking to secure a custom domain with an SSL binding.
Add a TLS/SSL certificate in Azure App Service
Use a TLS/SSL certificate in your code in Azure App Service
But you can override the framework code for SSL verification to include your particular cert
ServicePointManager.ServerCertificateValidationCallback
Refer the SO which will help you in overriding the framework

Use App Service Certificate with Azure Application Gateway

Created an app service certificate in Azure to enable SSL for Application Gateway.
Had already configured SSL on the Application Gateway with a self-signed .pfx certificate to test the functionality but wanted to go with a more robust, auto-renewed and Microsoft managed solution.
However, it seems that an "App Service Certificate" is not the same as a generic certificate and doesn't show up on the listener options config page on the Application Gateway when trying to add the cert from key vault to the app gateway.
Is there any way to re-use this certificate with the Application Gateway?
I came across this today and found out that it is the 'Azure Portal' that is incapable of adding a certificate stored as key vault secret. If you use Terraform/REST API/Az CLI etc, you can add a key vault secret to Application Gateway.
This is already documented by MS.
The Azure portal supports only Key Vault certificates, not secrets. Application Gateway still supports referencing secrets from Key Vault, but only through non-portal resources like PowerShell, the Azure CLI, APIs, and Azure Resource Manager templates (ARM templates).
Again, there is a partially correct warning which is only true for 'Azure Portal'
Azure Application Gateway currently supports only Key Vault accounts in the same subscription as the Application Gateway resource. Choosing a key vault under a different subscription than your Application Gateway will result in a failure.
A simple but manual solution is to download the certificate from key vault secret via Azure Portal and upload it as a key vault certificate. You will need to do this again when the certificate is renewed.

Cannot connect to external https from Azure SF due to untrusted certificate

I have an application, deployed in Azure Service Fabric.
The application connects to external web service which has an untrusted SSL certificate and fails.
I solved problem by implementing custom cert validation logic in "ServerCertificateCustomValidationCallback" method of HttpClient, however this is not an ideal solution.
How to install external SSL certificate into the trusted store on VMs in VMSS, so that any app in ASF can consume external web services without additional efforts?
Additional notes
Certificate contains no private key, so it cannot be imported into Azure key vault and used in ARM template (or I didn't find a way how to achieve this)
Certificate cannot be installed manually via RD, because this doesn't support autoscaling
It is possible to import .pfx certificate without password into Azure Key Valut. Certificate should be imported into Secrets (not into Certificates). Azure portal says, that this feature is deprecated but it works.
When certificate is in key valut, then ARM template can be used to deploy it onto VMs.
To get pfx certificates, I downloaded root and intermediate certificates in browser. Then converted .cer to .pfx via small .net console, written by myself - check X509Certificate class, it has all necessary methods.

Azure: export azure app service certificate locally

Referring to the question asked here, Azure: manually add app service certificate to key vault
Also quoting to answer given,
" App Service Certificate stores the private certificate into a user-provided Key Vault secret. When App Service Certificate is deployed into a web app, a Web Apps resource provider deploys it from the Key Vault secret that's associated with App Service Certificate.
So, when you add app service certificate to azure keyvault, you could not see anything in Certificate option. "
As I cannot see certificates in the key vault but the certificate is stored in user provided secret, but how to export it then?

Resources