Review Function App client certificate requirements

Require and validate client certificates for functions that need mutual TLS authentication.

Description

For a Function App that uses mutual TLS, require a client certificate over HTTPS. In Optional mode a caller can send a request without a certificate.

Potential impact

A forwarded certificate identifies an authorized caller only if the app verifies trust and checks the caller’s permissions.

Remediation

On current resources, enable client_certificate_enabled and set client_certificate_mode to Required. Validate the chain, validity period and caller permissions in the app. Test a protected function with an authorized certificate, then confirm it rejects requests with a missing or invalid certificate.

Examples

The AzureRM 3.x azurerm_function_app excerpts change client_cert_mode from Optional to Required. Configure HTTPS and required inputs such as storage separately.

Before

hcl
resource "azurerm_function_app" "example" {
  name                = "test-azure-functions"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  app_service_plan_id = azurerm_app_service_plan.example.id

  client_cert_mode = "Optional"
}

After

hcl
resource "azurerm_function_app" "example" {
  name                = "test-azure-functions"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  app_service_plan_id = azurerm_app_service_plan.example.id

  client_cert_mode = "Required"
}

References