Gallery › Mission › Azure built-in policies
Storage account should restrict IP rules in storage account firewall settings.
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. IP Rules in Storage Account Firewalls are restricted.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONStorageAllowedIPRules_Audit.json · 86 lines
{
"properties": {
"displayName": "Storage account should restrict IP rules in storage account firewall settings.",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. IP Rules in Storage Account Firewalls are restricted.",
"metadata": {
"version": "1.0.0",
"category": "Mission"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Storage Account allowed IP Rules Effect",
"description": "Specify the IP rules effect for the Storage Account"
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit"
},
"allowedAddressRanges": {
"type": "Array",
"metadata": {
"description": "The list of allowed IP address ranges (Allowed internet address ranges can be provided using CIDR notation in the form 10.0.0.0/24 or as individual IP addresses like 10.0.0.4)",
"displayName": "Allowed Address Ranges"
},
"defaultValue": []
},
"allowedVirtualNetworks": {
"type": "Array",
"metadata": {
"description": "The list of allowed Virtual Networks (Allowed Virtual Networks can be provided in Resource ID format)",
"displayName": "Allowed Virtual Networks"
},
"defaultValue": []
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Storage/storageAccounts"
},
{
"anyOf": [
{
"count": {
"field": "Microsoft.Storage/storageAccounts/networkAcls.ipRules[*]",
"where": {
"field": "Microsoft.Storage/storageAccounts/networkAcls.ipRules[*].value",
"notIn": "[parameters('allowedAddressRanges')]"
}
},
"greater": 0
},
{
"count": {
"field": "Microsoft.Storage/storageAccounts/networkAcls.virtualNetworkRules[*]",
"where": {
"field": "Microsoft.Storage/storageAccounts/networkAcls.virtualNetworkRules[*].id",
"notIn": "[parameters('allowedVirtualNetworks')]"
}
},
"greater": 0
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/d66025f8-6cad-476a-bbfb-3b66ae33f6ff",
"name": "d66025f8-6cad-476a-bbfb-3b66ae33f6ff"
}Bylawd66025f8-6cad-476a-bbfb-3b66ae33f6ff.bylaw.ps1 · 48 lines
# Converted from StorageAllowedIPRules_Audit.json by ConvertTo-Bylaw.
Policy 'd66025f8-6cad-476a-bbfb-3b66ae33f6ff' {
Properties @{
DisplayName = 'Storage account should restrict IP rules in storage account firewall settings.'
Description = 'This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. IP Rules in Storage Account Firewalls are restricted.'
Version = '1.0.0'
Category = 'Mission'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Storage Account allowed IP Rules Effect'
Description = 'Specify the IP rules effect for the Storage Account'
}
Parameter AllowedAddressRanges @{
Type = 'Array'
Default = @()
DisplayName = 'Allowed Address Ranges'
Description = 'The list of allowed IP address ranges (Allowed internet address ranges can be provided using CIDR notation in the form 10.0.0.0/24 or as individual IP addresses like 10.0.0.4)'
}
Parameter AllowedVirtualNetworks @{
Type = 'Array'
Default = @()
DisplayName = 'Allowed Virtual Networks'
Description = 'The list of allowed Virtual Networks (Allowed Virtual Networks can be provided in Resource ID format)'
}
Resource 'Microsoft.Storage/storageAccounts' {
Require 'networkAcls.ipRules and value are as required' {
Each 'networkAcls.ipRules[*]' {
Field value | Must -BeIn (Param AllowedAddressRanges) -Strict
}
}
Require 'networkAcls.virtualNetworkRules and id are as required' {
Each 'networkAcls.virtualNetworkRules[*]' {
Field id | Must -BeIn (Param AllowedVirtualNetworks) -Strict
}
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Mission/StorageAllowedIPRules_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw