Gallery › Container Registry › Azure built-in policies
Public network access should be disabled for Container registries
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
Disabling public network access improves security by ensuring that container registries are not exposed on the public internet. Creating private endpoints can limit exposure of container registry resources. Learn more at: https://aka.ms/acr/portal/public-network and https://aka.ms/acr/private-link.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONACR_PublicNetworkAccess_AuditDeny.json · 50 lines
{
"properties": {
"displayName": "Public network access should be disabled for Container registries",
"description": "Disabling public network access improves security by ensuring that container registries are not exposed on the public internet. Creating private endpoints can limit exposure of container registry resources. Learn more at: https://aka.ms/acr/portal/public-network and https://aka.ms/acr/private-link.",
"policyType": "BuiltIn",
"mode": "Indexed",
"metadata": {
"version": "1.0.0",
"category": "Container Registry"
},
"version": "1.0.0",
"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.ContainerRegistry/registries"
},
{
"field": "Microsoft.ContainerRegistry/registries/publicNetworkAccess",
"notEquals": "Disabled"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/0fdf0491-d080-4575-b627-ad0e843cba0f",
"name": "0fdf0491-d080-4575-b627-ad0e843cba0f"
}Bylaw0fdf0491-d080-4575-b627-ad0e843cba0f.bylaw.ps1 · 28 lines
# Converted from ACR_PublicNetworkAccess_AuditDeny.json by ConvertTo-Bylaw.
Policy '0fdf0491-d080-4575-b627-ad0e843cba0f' {
Properties @{
DisplayName = 'Public network access should be disabled for Container registries'
Description = 'Disabling public network access improves security by ensuring that container registries are not exposed on the public internet. Creating private endpoints can limit exposure of container registry resources. Learn more at: https://aka.ms/acr/portal/public-network and https://aka.ms/acr/private-link.'
Version = '1.0.0'
Category = 'Container Registry'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.ContainerRegistry/registries' {
Require 'publicNetworkAccess is Disabled' {
Field publicNetworkAccess | Must -Be 'Disabled'
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Container Registry/ACR_PublicNetworkAccess_AuditDeny.json in Azure/azure-policy, under the MIT licence.
Bylaw