Function App authentication disabled This product is not supported for your selected
Datadog site . (
).
Id: terraform-azure-function-app-authentication-disabled
Provider: Azure
Platform: Terraform
Severity: Medium
Category: Access Control
Learn More Description Azure Function App authentication settings should be enabled to ensure that only authorized users and services can access the deployed function endpoints. Leaving authentication (auth_settings { enabled = true }) disabled, as shown below, permits unauthenticated, potentially malicious access to the function app, increasing the risk of data exposure or unauthorized actions:
resource "azurerm_function_app" "example" {
// ...other config...
auth_settings {
enabled = true
}
}
Enabling authentication protects sensitive operations and helps prevent unauthorized or anonymous interaction with serverless workloads.
Compliant Code Examples resource "azurerm_function_app" "negative" {
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
storage_account_name = azurerm_storage_account . example . name
storage_account_access_key = azurerm_storage_account . example . primary_access_key
auth_settings {
enabled = true
}
}
resource "azurerm_resource_group" "example" {
name = "test-rg"
location = "eastus"
}
resource "azurerm_storage_account" "example" {
name = "testazurefunctionssa"
resource_group_name = azurerm_resource_group . example . name
location = azurerm_resource_group . example . location
account_tier = "Standard"
account_replication_type = "LRS"
}
resource "azurerm_service_plan" "example" {
name = "test-service-plan"
resource_group_name = azurerm_resource_group . example . name
location = azurerm_resource_group . example . location
os_type = "Windows"
sku_name = "Y1"
}
resource "azurerm_windows_function_app" "negative2" {
name = "test-azure-functions-v2"
location = azurerm_resource_group . example . location
resource_group_name = azurerm_resource_group . example . name
service_plan_id = azurerm_service_plan . example . id
storage_account_name = azurerm_storage_account . example . name
storage_account_access_key = azurerm_storage_account . example . primary_access_key
site_config {}
auth_settings_v2 {
auth_enabled = true
login {}
active_directory_v2 {
client_id = "00000000-0000-0000-0000-000000000000"
tenant_auth_endpoint = "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/v2.0"
}
}
}
Non-Compliant Code Examples resource "azurerm_function_app" "positive1" {
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
storage_account_name = azurerm_storage_account . example . name
storage_account_access_key = azurerm_storage_account . example . primary_access_key
}
resource "azurerm_function_app" "positive2" {
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
storage_account_name = azurerm_storage_account . example . name
storage_account_access_key = azurerm_storage_account . example . primary_access_key
auth_settings {
enabled = false
}
}