Gallery › Container Apps › Azure built-in policies
Managed Identity should be enabled for Container Apps
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.1
Enforcing managed identity ensures Container Apps can securely authenticate to any resource that supports Azure AD authentication
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONManagedIdentity_Audit.json · 58 lines
{
"properties": {
"displayName": "Managed Identity should be enabled for Container Apps",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Enforcing managed identity ensures Container Apps can securely authenticate to any resource that supports Azure AD authentication",
"metadata": {
"version": "1.0.1",
"category": "Container Apps"
},
"version": "1.0.1",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.App/containerApps"
},
{
"anyOf": [
{
"field": "identity.type",
"exists": false
},
{
"field": "identity.type",
"equals": "none"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/b874ab2d-72dd-47f1-8cb5-4a306478a4e7",
"name": "b874ab2d-72dd-47f1-8cb5-4a306478a4e7"
}Bylawb874ab2d-72dd-47f1-8cb5-4a306478a4e7.bylaw.ps1 · 32 lines
# Converted from ManagedIdentity_Audit.json by ConvertTo-Bylaw.
Policy 'b874ab2d-72dd-47f1-8cb5-4a306478a4e7' {
Properties @{
DisplayName = 'Managed Identity should be enabled for Container Apps'
Description = 'Enforcing managed identity ensures Container Apps can securely authenticate to any resource that supports Azure AD authentication'
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 'identity.type exists' {
Field identity.type | Must -Exist
}
Require 'identity.type is not none' {
Field identity.type | Must -Not -Be 'none' -IfPresent
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Container Apps/ManagedIdentity_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw