Description
Decide who should be able to call each HTTP function. If the Function App omits platform authentication, check function keys and application-level authentication on the actual route. A shared function key cannot identify individual users.
Potential impact
An unprotected function can read or change data with its own permissions on behalf of an unintended caller. Repeated calls can also increase resource use and cost.
Remediation
When using platform authentication, configure the identity provider and deny anonymous requests to protected paths or redirect them to sign-in. Test the actual function URL. Anonymous callers and signed-in users without permission should be unable to perform the operation, while authorized users should have only the access they need.
Examples
The second AzureRM 3.x azurerm_function_app example enables auth_settings.enabled. Keep your existing site_config when changing only authentication. Supply the identity provider, request-handling policy and required storage settings. Use the Function App resource for your operating system in current configurations.
Before
resource "azurerm_function_app" "example" {
name = "example-app-service"
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 {
dotnet_framework_version = "v4.0"
scm_type = "LocalGit"
}
}
After
resource "azurerm_function_app" "example" {
name = "example-app-service"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
app_service_plan_id = azurerm_app_service_plan.example.id
auth_settings {
enabled = true
}
}