Review Function App FTP transport protection

Check publishing settings to prevent plaintext FTP transfers to a Function App.

Description

Choose site_config.ftps_state to suit the Function App’s deployment method. Select FtpsOnly if you publish over FTP, or Disabled if you do not.

Potential impact

Publishing over plaintext FTP with AllAllowed can expose function code and publishing credentials. Someone with those credentials may be able to change deployed files.

Remediation

For FtpsOnly, set the app’s minimum inbound TLS version to 1.2 or later. Check that the hosting plan and both FTP and SCM basic publishing authentication policies allow FTPS. Otherwise, use an approved encrypted deployment method. Restrict publishing permissions, test deployment through the chosen path, and verify that plaintext FTP is rejected. Configure HTTPS separately for the function URL.

Examples

The AzureRM 3.x azurerm_function_app excerpts omit required storage settings. The second also omits http2_enabled, so keep your existing HTTP/2 setting when changing only FTP. Check the effective publishing settings on current resources, where defaults can differ.

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

  site_config {
    http2_enabled = true
    ftps_state    = "AllAllowed"
  }
}

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

  site_config {
    ftps_state = "FtpsOnly"
  }
}

References