Gallery › Container Registry › Azure built-in policies
Configure container registries to disable anonymous authentication.
Converted Policy Disabled Modify Mode Indexed Version 1.0.0
Disable anonymous pull for your registry so that data not accessible by unauthenticated user. Disabling local authentication methods like admin user, repository scoped access tokens and anonymous pull improves security by ensuring that container registries exclusively require Azure Active Directory identities for authentication. Learn more at: https://aka.ms/acr/authentication.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONACR_AnonymousPullDisabled_Modify.json · 62 lines
{
"properties": {
"displayName": "Configure container registries to disable anonymous authentication.",
"description": "Disable anonymous pull for your registry so that data not accessible by unauthenticated user. Disabling local authentication methods like admin user, repository scoped access tokens and anonymous pull improves security by ensuring that container registries exclusively require Azure Active Directory identities for authentication. Learn more at: https://aka.ms/acr/authentication.",
"policyType": "BuiltIn",
"mode": "Indexed",
"metadata": {
"version": "1.0.0",
"category": "Container Registry"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"defaultValue": "Modify",
"allowedValues": [
"Modify",
"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/anonymousPullEnabled",
"equals": true
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"conflictEffect": "audit",
"roleDefinitionIds": [
"/providers/microsoft.authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
],
"operations": [
{
"operation": "addOrReplace",
"field": "Microsoft.ContainerRegistry/registries/anonymousPullEnabled",
"value": false
}
]
}
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/cced2946-b08a-44fe-9fd9-e4ed8a779897",
"name": "cced2946-b08a-44fe-9fd9-e4ed8a779897"
}Bylawcced2946-b08a-44fe-9fd9-e4ed8a779897.bylaw.ps1 · 30 lines
# Converted from ACR_AnonymousPullDisabled_Modify.json by ConvertTo-Bylaw.
Policy 'cced2946-b08a-44fe-9fd9-e4ed8a779897' {
Properties @{
DisplayName = 'Configure container registries to disable anonymous authentication.'
Description = 'Disable anonymous pull for your registry so that data not accessible by unauthenticated user. Disabling local authentication methods like admin user, repository scoped access tokens and anonymous pull improves security by ensuring that container registries exclusively require Azure Active Directory identities for authentication. Learn more at: https://aka.ms/acr/authentication.'
Version = '1.0.0'
Category = 'Container Registry'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Modify', 'Disabled')
Default = 'Modify'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.ContainerRegistry/registries' {
Require 'anonymousPullEnabled is not true' {
Field anonymousPullEnabled | Must -Not -Be $true -IfPresent
}
}
Modify -Role 'Contributor' -ConflictEffect Audit -Effect (Param Effect) {
Field anonymousPullEnabled | AddOrReplace $false
}
}Source: built-in-policies/policyDefinitions/Container Registry/ACR_AnonymousPullDisabled_Modify.json in Azure/azure-policy, under the MIT licence.
Bylaw