Gallery › App Service › Azure Landing Zones Library
API App should only be accessible over HTTPS
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
Use of HTTPS ensures server/service authentication and protects data in transit from network layer eavesdropping attacks.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONDeny-AppServiceApiApp-http.alz_policy_definition.json · 56 lines
{
"name": "Deny-AppServiceApiApp-http",
"properties": {
"description": "Use of HTTPS ensures server/service authentication and protects data in transit from network layer eavesdropping attacks.",
"displayName": "API App should only be accessible over HTTPS",
"metadata": {
"alzCloudEnvironments": [
"AzureCloud",
"AzureChinaCloud",
"AzureUSGovernment"
],
"category": "App Service",
"source": "https://github.com/Azure/Enterprise-Scale/",
"version": "1.0.0"
},
"mode": "Indexed",
"parameters": {
"effect": {
"allowedValues": [
"Audit",
"Disabled",
"Deny"
],
"defaultValue": "Deny",
"metadata": {
"description": "Enable or disable the execution of the policy",
"displayName": "Effect"
},
"type": "String"
}
},
"policyRule": {
"if": {
"allOf": [
{
"equals": "Microsoft.Web/sites",
"field": "type"
},
{
"field": "kind",
"like": "*api"
},
{
"equals": "false",
"field": "Microsoft.Web/sites/httpsOnly"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"policyType": "Custom"
},
"type": "Microsoft.Authorization/policyDefinitions"
}BylawDeny-AppServiceApiApp-http.bylaw.ps1 · 32 lines
# Converted from Deny-AppServiceApiApp-http.alz_policy_definition.json by ConvertTo-Bylaw.
Policy 'Deny-AppServiceApiApp-http' {
Properties @{
DisplayName = 'API App should only be accessible over HTTPS'
Description = 'Use of HTTPS ensures server/service authentication and protects data in transit from network layer eavesdropping attacks.'
Category = 'App Service'
Version = '1.0.0'
Mode = 'Indexed'
Metadata = [ordered]@{ alzCloudEnvironments = @('AzureCloud', 'AzureChinaCloud', 'AzureUSGovernment'); source = 'https://github.com/Azure/Enterprise-Scale/' }
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled', 'Deny')
Default = 'Deny'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Web/sites' {
When {
Field kind | Must -BeLike '*api'
}
Require 'httpsOnly is not false' {
Field httpsOnly | Must -Not -Be 'false' -IfPresent
}
}
Effect (Param Effect)
}Source: policy_definitions/Deny-AppServiceApiApp-http.alz_policy_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.
Bylaw