Gallery › App Service › Azure built-in policies
Function apps should use latest 'HTTP Version'
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 4.1.0
Periodically, newer versions are released for HTTP either due to security flaws or to include additional functionality. Using the latest HTTP version for web apps to take advantage of security fixes, if any, and/or new functionalities of the newer version.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONFunctionApp_Audit_HTTP_Latest.json · 66 lines
{
"properties": {
"displayName": "Function apps should use latest 'HTTP Version'",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Periodically, newer versions are released for HTTP either due to security flaws or to include additional functionality. Using the latest HTTP version for web apps to take advantage of security fixes, if any, and/or new functionalities of the newer version.",
"metadata": {
"version": "4.1.0",
"category": "App Service"
},
"version": "4.1.0",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "AuditIfNotExists",
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Web/sites"
},
{
"field": "kind",
"contains": "functionapp"
},
{
"field": "kind",
"notContains": "workflowapp"
},
{
"field": "kind",
"notContains": "azurecontainerapps"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Web/sites/config",
"name": "web",
"existenceCondition": {
"field": "Microsoft.Web/sites/config/web.http20Enabled",
"equals": "true"
}
}
}
},
"versions": [
"4.1.0",
"4.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/e2c1c086-2d84-4019-bff3-c44ccd95113c",
"name": "e2c1c086-2d84-4019-bff3-c44ccd95113c"
}Bylawe2c1c086-2d84-4019-bff3-c44ccd95113c.bylaw.ps1 · 38 lines
# Converted from FunctionApp_Audit_HTTP_Latest.json by ConvertTo-Bylaw.
Policy 'e2c1c086-2d84-4019-bff3-c44ccd95113c' {
Properties @{
DisplayName = 'Function apps should use latest ''HTTP Version'''
Description = 'Periodically, newer versions are released for HTTP either due to security flaws or to include additional functionality. Using the latest HTTP version for web apps to take advantage of security fixes, if any, and/or new functionalities of the newer version.'
Version = '4.1.0'
Category = 'App Service'
PolicyVersion = '4.1.0'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Web/sites' {
When {
Field kind | Must -ContainText 'functionapp'
Field kind | Must -Not -ContainText 'workflowapp'
}
Require 'kind contains azurecontainerapps' {
Field kind | Must -ContainText 'azurecontainerapps'
}
}
AuditIfNotExists 'Microsoft.Web/sites/config' -Name 'web' -Effect (Param Effect) {
Require 'web.http20Enabled is true' {
Field web.http20Enabled | Must -Be 'true'
}
}
}Source: built-in-policies/policyDefinitions/App Service/FunctionApp_Audit_HTTP_Latest.json in Azure/azure-policy, under the MIT licence.
Bylaw