Gallery › App Service › Azure built-in policies
Function apps should require FTPS only
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 3.1.0
Enable FTPS enforcement for enhanced security.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONAuditFTPS_FunctionApp_Audit.json · 69 lines
{
"properties": {
"displayName": "Function apps should require FTPS only",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Enable FTPS enforcement for enhanced security.",
"metadata": {
"version": "3.1.0",
"category": "App Service"
},
"version": "3.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/ftpsState",
"in": [
"FtpsOnly",
"Disabled"
]
}
}
}
},
"versions": [
"3.1.0",
"3.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/399b2637-a50f-4f95-96f8-3a145476eb15",
"name": "399b2637-a50f-4f95-96f8-3a145476eb15"
}Bylaw399b2637-a50f-4f95-96f8-3a145476eb15.bylaw.ps1 · 38 lines
# Converted from AuditFTPS_FunctionApp_Audit.json by ConvertTo-Bylaw.
Policy '399b2637-a50f-4f95-96f8-3a145476eb15' {
Properties @{
DisplayName = 'Function apps should require FTPS only'
Description = 'Enable FTPS enforcement for enhanced security.'
Version = '3.1.0'
Category = 'App Service'
PolicyVersion = '3.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 'ftpsState is one of 2 values' {
Field ftpsState | Must -BeIn @('FtpsOnly', 'Disabled')
}
}
}Source: built-in-policies/policyDefinitions/App Service/AuditFTPS_FunctionApp_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw