Gallery › VirtualEnclaves › Azure built-in policies
Storage Accounts should restrict network access through network ACL bypass configuration only.
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
To improve the security of Storage Accounts, enable access only through network ACL bypass. This policy should be used in combination with a private endpoint for storage account access.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONStorageNetworkAccessBypassOnly_AuditDeny.json · 94 lines
{
"properties": {
"displayName": "Storage Accounts should restrict network access through network ACL bypass configuration only.",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "To improve the security of Storage Accounts, enable access only through network ACL bypass. This policy should be used in combination with a private endpoint for storage account access.",
"metadata": {
"version": "1.0.0",
"category": "VirtualEnclaves"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the audit policy"
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit"
},
"bypassConfiguration": {
"type": "String",
"metadata": {
"displayName": "Bypass Configuration",
"description": "Bypass the policy for storage accounts that match the configuration"
},
"allowedValues": [
"None",
"AzureServices",
"Logging",
"Metrics",
"Logging, Metrics",
"Logging, Metrics, AzureServices",
"Logging, AzureServices",
"Metrics, AzureServices"
],
"defaultValue": "AzureServices"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Storage/storageAccounts"
},
{
"anyOf": [
{
"field": "Microsoft.Storage/storageAccounts/networkAcls.defaultAction",
"notEquals": "Deny"
},
{
"count": {
"field": "Microsoft.Storage/storageAccounts/networkAcls.ipRules[*]"
},
"greaterOrEquals": 1
},
{
"count": {
"field": "Microsoft.Storage/storageAccounts/networkAcls.resourceAccessRules[*]"
},
"greaterOrEquals": 1
},
{
"count": {
"field": "Microsoft.Storage/storageAccounts/networkAcls.virtualNetworkRules[*]"
},
"greaterOrEquals": 1
},
{
"field": "Microsoft.Storage/storageAccounts/networkAcls.bypass",
"notEquals": "[parameters('bypassConfiguration')]"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/7809fda1-ba27-48c1-9c63-1f5aee46ba89",
"name": "7809fda1-ba27-48c1-9c63-1f5aee46ba89"
}Bylaw7809fda1-ba27-48c1-9c63-1f5aee46ba89.bylaw.ps1 · 50 lines
# Converted from StorageNetworkAccessBypassOnly_AuditDeny.json by ConvertTo-Bylaw.
Policy '7809fda1-ba27-48c1-9c63-1f5aee46ba89' {
Properties @{
DisplayName = 'Storage Accounts should restrict network access through network ACL bypass configuration only.'
Description = 'To improve the security of Storage Accounts, enable access only through network ACL bypass. This policy should be used in combination with a private endpoint for storage account access.'
Version = '1.0.0'
Category = 'VirtualEnclaves'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the audit policy'
}
Parameter BypassConfiguration @{
AllowedValues = @('None', 'AzureServices', 'Logging', 'Metrics', 'Logging, Metrics', 'Logging, Metrics, AzureServices', 'Logging, AzureServices', 'Metrics, AzureServices')
Default = 'AzureServices'
DisplayName = 'Bypass Configuration'
Description = 'Bypass the policy for storage accounts that match the configuration'
}
Resource 'Microsoft.Storage/storageAccounts' {
Require 'networkAcls.defaultAction is Deny' {
Field networkAcls.defaultAction | Must -Be 'Deny'
}
Require 'networkAcls.ipRules is as required' {
Count 'networkAcls.ipRules[*]' | Must -Be 0
}
Require 'networkAcls.resourceAccessRules is as required' {
Count 'networkAcls.resourceAccessRules[*]' | Must -Be 0
}
Require 'networkAcls.virtualNetworkRules is as required' {
Count 'networkAcls.virtualNetworkRules[*]' | Must -Be 0
}
Require 'networkAcls.bypass is the BypassConfiguration parameter' {
Field networkAcls.bypass | Must -Be (Param BypassConfiguration)
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/VirtualEnclaves/StorageNetworkAccessBypassOnly_AuditDeny.json in Azure/azure-policy, under the MIT licence.
Bylaw