Gallery › Mission › Azure built-in policies
Restrict Slot Configuration Access Rules
Converted Policy Audit Deny Disabled Mode All Version 1.1.0
This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Restrict Slot Configuration Access Rules to Specified Sources.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONAppConfigRestrictSlotAccessRules_Audit.json · 131 lines
{
"properties": {
"displayName": "Restrict Slot Configuration Access Rules",
"policyType": "BuiltIn",
"mode": "All",
"description": "This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Restrict Slot Configuration Access Rules to Specified Sources.",
"metadata": {
"version": "1.1.0",
"category": "Mission"
},
"version": "1.1.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit"
},
"allowedServiceTags": {
"type": "Array",
"metadata": {
"displayName": "Allowed Service Tags",
"description": "List of allowed Service Tags."
},
"defaultValue": []
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Web/sites/slots/config"
},
{
"anyOf": [
{
"count": {
"field": "Microsoft.Web/sites/slots/config/ipSecurityRestrictions[*]",
"where": {
"not": {
"anyOf": [
{
"allOf": [
{
"value": "[current('Microsoft.Web/sites/slots/config/ipSecurityRestrictions[*].tag')]",
"equals": "ServiceTag"
},
{
"value": "[current('Microsoft.Web/sites/slots/config/ipSecurityRestrictions[*].ipAddress')]",
"in": "[parameters('allowedServiceTags')]"
}
]
},
{
"allOf": [
{
"value": "[current('Microsoft.Web/sites/slots/config/ipSecurityRestrictions[*].Action')]",
"equals": "Deny"
},
{
"value": "[current('Microsoft.Web/sites/slots/config/ipSecurityRestrictions[*].ipAddress')]",
"equals": "Any"
}
]
}
]
}
}
},
"greater": 0
},
{
"count": {
"field": "Microsoft.Web/sites/slots/config/scmIpSecurityRestrictions[*]",
"where": {
"not": {
"anyOf": [
{
"allOf": [
{
"value": "[current('Microsoft.Web/sites/slots/config/scmIpSecurityRestrictions[*].tag')]",
"equals": "ServiceTag"
},
{
"value": "[current('Microsoft.Web/sites/slots/config/scmIpSecurityRestrictions[*].ipAddress')]",
"in": "[parameters('allowedServiceTags')]"
}
]
},
{
"allOf": [
{
"value": "[current('Microsoft.Web/sites/slots/config/scmIpSecurityRestrictions[*].Action')]",
"equals": "Deny"
},
{
"value": "[current('Microsoft.Web/sites/slots/config/scmIpSecurityRestrictions[*].ipAddress')]",
"equals": "Any"
}
]
}
]
}
}
},
"greater": 0
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.1.0",
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/f9fd212a-5a3c-4754-a9af-560ec3b1ae13",
"name": "f9fd212a-5a3c-4754-a9af-560ec3b1ae13"
}Bylawf9fd212a-5a3c-4754-a9af-560ec3b1ae13.bylaw.ps1 · 56 lines
# Converted from AppConfigRestrictSlotAccessRules_Audit.json by ConvertTo-Bylaw.
Policy 'f9fd212a-5a3c-4754-a9af-560ec3b1ae13' {
Properties @{
DisplayName = 'Restrict Slot Configuration Access Rules'
Description = 'This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Restrict Slot Configuration Access Rules to Specified Sources.'
Version = '1.1.0'
Category = 'Mission'
PolicyVersion = '1.1.0'
Mode = 'All'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Parameter AllowedServiceTags @{
Type = 'Array'
Default = @()
DisplayName = 'Allowed Service Tags'
Description = 'List of allowed Service Tags.'
}
Resource 'Microsoft.Web/sites/slots/config' {
Require 'ipSecurityRestrictions is as required' {
Count 'ipSecurityRestrictions[*]' -Where {
AnyOf {
Arm '[current(''Microsoft.Web/sites/slots/config/ipSecurityRestrictions[*].tag'')]' | Must -Not -Be 'ServiceTag'
Arm '[current(''Microsoft.Web/sites/slots/config/ipSecurityRestrictions[*].ipAddress'')]' | Must -Not -BeIn (Param AllowedServiceTags)
}
AnyOf {
Arm '[current(''Microsoft.Web/sites/slots/config/ipSecurityRestrictions[*].Action'')]' | Must -Not -Be 'Deny'
Arm '[current(''Microsoft.Web/sites/slots/config/ipSecurityRestrictions[*].ipAddress'')]' | Must -Not -Be 'Any'
}
} | Must -Be 0
}
Require 'scmIpSecurityRestrictions is as required' {
Count 'scmIpSecurityRestrictions[*]' -Where {
AnyOf {
Arm '[current(''Microsoft.Web/sites/slots/config/scmIpSecurityRestrictions[*].tag'')]' | Must -Not -Be 'ServiceTag'
Arm '[current(''Microsoft.Web/sites/slots/config/scmIpSecurityRestrictions[*].ipAddress'')]' | Must -Not -BeIn (Param AllowedServiceTags)
}
AnyOf {
Arm '[current(''Microsoft.Web/sites/slots/config/scmIpSecurityRestrictions[*].Action'')]' | Must -Not -Be 'Deny'
Arm '[current(''Microsoft.Web/sites/slots/config/scmIpSecurityRestrictions[*].ipAddress'')]' | Must -Not -Be 'Any'
}
} | Must -Be 0
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Mission/AppConfigRestrictSlotAccessRules_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw