No custom-domain binding or certificate upload is required on the Function App when the backend target is my-function-app.azurewebsites.net and Application Gateway uses that FQDN as the backend TLS hostname.
Recommended configuration
Keep the two TLS connections logically separate:
- Client → Application Gateway
- Listener hostname: your public custom domain.
- Listener certificate: the DigiCert certificate from Key Vault.
- Mobile certificate pinning applies to this certificate.
- Application Gateway → Function App
- Backend pool target:
my-function-app.azurewebsites.net.
- Protocol:
HTTPS.
- Port:
443.
- Select Pick hostname from backend target.
- Keep certificate-chain, expiry, and SNI validation enabled.
With Application Gateway v2, picking the hostname from the backend target sets SNI to the backend-pool FQDN. The certificate presented by the backend must match that FQDN.^1^
Azure Functions already provides a platform-managed certificate for the default *.azurewebsites.net domain, including on Flex Consumption.^2^ Azure-managed *.azurewebsites.net domains require no additional certificate configuration.^3^
Application Gateway trusts certificates issued by public certificate authorities and implicitly trusts Azure App Service and other Azure web-service backends. Therefore, no backend certificate or trusted-root upload is needed for this configuration.^1^
Health probe configuration
If using the default probe, the hostname selected in the associated backend setting is used for backend TLS validation.
If using a custom probe, configure it as follows:
- Protocol: HTTPS
- Host: select Pick hostname from backend setting, or explicitly enter
my-function-app.azurewebsites.net
- Path: an anonymous endpoint that returns an accepted success status
- Associate the probe with the HTTPS backend setting
The probe hostname and backend-setting hostname must match the certificate subject name used for SNI. Otherwise, the backend can be marked unhealthy and Application Gateway can return HTTP 502.^4^
Check the result under:
Azure portal → Application Gateway → Backend health
The Function App backend should report Healthy.
When a custom domain is required on the Function App
Bind a custom domain and matching certificate to the Function App only when the backend TLS connection itself must use that custom hostname. Examples include:
- The backend pool or backend setting uses
api.contoso.com rather than my-function-app.azurewebsites.net.
- A custom probe sends
api.contoso.com as its TLS/HTTP hostname.
- The application requires the original public custom hostname in the backend
Host header and the gateway is configured to preserve that hostname rather than override it with the Function App hostname.
- Backend routing, authorization, or application logic explicitly depends on a custom backend host.
- An organizational policy requires the same custom DNS identity across both TLS connections.
In those cases:
- Map the custom domain to the Function App.
- Add a certificate whose subject/SAN covers that domain.
- Bind the certificate to the custom domain.
- Configure the Application Gateway backend hostname/SNI and probe hostname to use the same custom domain.
App Service requires a certificate binding when HTTPS is served through a custom domain.^5^
If a private-CA or self-signed certificate is used instead, upload its corresponding root CA certificate to the Application Gateway backend setting. This is not necessary for the current *.azurewebsites.net platform certificate because Application Gateway’s default trust store supports public CAs and trusted Azure services.^6^
A custom domain configured only on the Application Gateway listener does not require the same domain or certificate to be installed on the Function App. TLS is terminated at the listener, and Application Gateway creates a separate TLS session to the *.azurewebsites.net backend.^1^
References
- Overview of TLS termination and end to end TLS with Application Gateway
- Azure Functions hosting options
- What is TLS/SSL in Azure App Service?
- Troubleshoot backend health issues in Application Gateway
- Enable HTTPS for a custom domain in Azure App Service
- Application Gateway backend settings configuration