Gallery › Container Apps › Azure built-in policies
Container Apps should only be accessible over HTTPS
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.1
Use of HTTPS ensures server/service authentication and protects data in transit from network layer eavesdropping attacks. Disabling 'allowInsecure' will result in the automatic redirection of requests from HTTP to HTTPS connections for container apps.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONEnableHTTPS_Audit.json · 50 lines
{
"properties": {
"displayName": "Container Apps should only be accessible over HTTPS",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Use of HTTPS ensures server/service authentication and protects data in transit from network layer eavesdropping attacks. Disabling 'allowInsecure' will result in the automatic redirection of requests from HTTP to HTTPS connections for container apps.",
"metadata": {
"version": "1.0.1",
"category": "Container Apps"
},
"version": "1.0.1",
"parameters": {
"effect": {
"type": "String",
"defaultValue": "Audit",
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.App/containerApps"
},
{
"field": "Microsoft.App/containerApps/configuration.ingress.allowInsecure",
"equals": true
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/0e80e269-43a4-4ae9-b5bc-178126b8a5cb",
"name": "0e80e269-43a4-4ae9-b5bc-178126b8a5cb"
}Bylaw0e80e269-43a4-4ae9-b5bc-178126b8a5cb.bylaw.ps1 · 28 lines
# Converted from EnableHTTPS_Audit.json by ConvertTo-Bylaw.
Policy '0e80e269-43a4-4ae9-b5bc-178126b8a5cb' {
Properties @{
DisplayName = 'Container Apps should only be accessible over HTTPS'
Description = 'Use of HTTPS ensures server/service authentication and protects data in transit from network layer eavesdropping attacks. Disabling ''allowInsecure'' will result in the automatic redirection of requests from HTTP to HTTPS connections for container apps.'
Version = '1.0.1'
Category = 'Container Apps'
PolicyVersion = '1.0.1'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.App/containerApps' {
Require 'configuration.ingress.allowInsecure is not true' {
Field configuration.ingress.allowInsecure | Must -Not -Be $true -IfPresent
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Container Apps/EnableHTTPS_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw