Gallery › App Service › Azure built-in policies
[Deprecated]: Authentication should be enabled on your API app
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.0-deprecated Deprecated
Azure App Service Authentication is a feature that can prevent anonymous HTTP requests from reaching the API app, or authenticate those that have tokens before they reach the API app. We recommend all customers who are still using API apps to implement the built-in policy called 'App Service apps should have authentication enabled', which is scoped to include API apps in addition to Web apps.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
{
"properties": {
"displayName": "[Deprecated]: Authentication should be enabled on your API app",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Azure App Service Authentication is a feature that can prevent anonymous HTTP requests from reaching the API app, or authenticate those that have tokens before they reach the API app. We recommend all customers who are still using API apps to implement the built-in policy called 'App Service apps should have authentication enabled', which is scoped to include API apps in addition to Web apps.",
"metadata": {
"version": "1.0.0-deprecated",
"category": "App Service",
"deprecated": true
},
"version": "1.0.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",
"like": "*api"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Web/sites/config",
"name": "web",
"existenceCondition": {
"field": "Microsoft.Web/sites/config/siteAuthEnabled",
"equals": "true"
}
}
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/c4ebc54a-46e1-481a-bee2-d4411e95d828",
"name": "c4ebc54a-46e1-481a-bee2-d4411e95d828"
}# Converted from Authentication_ApiApp_Audit.json by ConvertTo-Bylaw.
Policy 'c4ebc54a-46e1-481a-bee2-d4411e95d828' {
Properties @{
DisplayName = '[Deprecated]: Authentication should be enabled on your API app'
Description = 'Azure App Service Authentication is a feature that can prevent anonymous HTTP requests from reaching the API app, or authenticate those that have tokens before they reach the API app. We recommend all customers who are still using API apps to implement the built-in policy called ''App Service apps should have authentication enabled'', which is scoped to include API apps in addition to Web apps.'
Version = '1.0.0-deprecated'
Category = 'App Service'
Deprecated = $true
PolicyVersion = '1.0.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' {
Require 'kind is not like *api' {
Field kind | Must -Not -BeLike '*api' -IfPresent
}
}
AuditIfNotExists 'Microsoft.Web/sites/config' -Name 'web' -Effect (Param Effect) {
Require 'siteAuthEnabled is true' {
Field siteAuthEnabled | Must -Be 'true'
}
}
}Source: built-in-policies/policyDefinitions/App Service/Authentication_ApiApp_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw