Bylaw

Gallery › App Service › Azure Community Policy

App services should have local authentication methods disabled for FTP deployments

Converted Policy AuditIfNotExists Disabled Mode All Version 1.0.0

Disabling local authentication methods for FTP deployments improves security by ensuring that App Service apps exclusively require Microsoft Entra identities for authentication. Learn more at: https://aka.ms/app-service-disable-basic-auth.

ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.

Azure Policy JSONazurepolicy.json · 52 lines
{
  "name": "d15c0177-f092-4797-82ef-cb2ec89cf527",
  "type": "Microsoft.Authorization/policyDefinitions",
  "properties": {
    "displayName": "App services should have local authentication methods disabled for FTP deployments",
    "description": "Disabling local authentication methods for FTP deployments improves security by ensuring that App Service apps exclusively require Microsoft Entra identities for authentication. Learn more at: https://aka.ms/app-service-disable-basic-auth.",
    "metadata": {
      "version": "1.0.0",
      "category": "App Service"
    },
    "mode": "All",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "AuditIfNotExists or Disabled the execution of the Policy"
        },
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "defaultValue": "AuditIfNotExists"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Web/sites"
          },
          {
            "field": "kind",
            "notContains": "functionapp"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "name": "ftp",
          "type": "Microsoft.Web/sites/basicPublishingCredentialsPolicies",
          "existenceCondition": {
            "field": "Microsoft.Web/sites/basicPublishingCredentialsPolicies/allow",
            "equals": "false"
          }
        }
      }
    }
  }
}
Bylawd15c0177-f092-4797-82ef-cb2ec89cf527.bylaw.ps1 · 31 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy 'd15c0177-f092-4797-82ef-cb2ec89cf527' {

    Properties @{
        DisplayName = 'App services should have local authentication methods disabled for FTP deployments'
        Description = 'Disabling local authentication methods for FTP deployments improves security by ensuring that App Service apps exclusively require Microsoft Entra identities for authentication. Learn more at: https://aka.ms/app-service-disable-basic-auth.'
        Version     = '1.0.0'
        Category    = 'App Service'
        Mode        = 'All'
    }

    Parameter Effect @{
        AllowedValues = @('AuditIfNotExists', 'Disabled')
        Default       = 'AuditIfNotExists'
        DisplayName   = 'Effect'
        Description   = 'AuditIfNotExists or Disabled the execution of the Policy'
    }

    Resource 'Microsoft.Web/sites' {

        Require 'kind contains functionapp' {
            Field kind | Must -ContainText 'functionapp'
        }
    }

    AuditIfNotExists 'Microsoft.Web/sites/basicPublishingCredentialsPolicies' -Name 'ftp' -Effect (Param Effect) {
        Require 'allow is false' {
            Field allow | Must -Be 'false'
        }
    }
}

Source: policyDefinitions/App Service/web-apps-should-have-ftp-basic-auth-disabled/azurepolicy.json in Azure/Community-Policy, under the MIT licence.