Gallery › Network › Azure built-in policies
Storage Accounts should use a virtual network service endpoint
Converted Policy Audit Disabled Mode Indexed Version 1.0.0
This policy audits any Storage Account not configured to use a virtual network service endpoint.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONVirtualNetworkServiceEndpoint_StorageAccount_Audit.json · 57 lines
{
"properties": {
"displayName": "Storage Accounts should use a virtual network service endpoint",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "This policy audits any Storage Account not configured to use a virtual network service endpoint.",
"metadata": {
"version": "1.0.0",
"category": "Network"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "Audit",
"allowedValues": [
"Audit",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Storage/storageAccounts"
},
{
"anyOf": [
{
"field": "Microsoft.Storage/storageAccounts/networkAcls.defaultAction",
"notEquals": "Deny"
},
{
"field": "Microsoft.Storage/storageAccounts/networkAcls.virtualNetworkRules[*].id",
"exists": "false"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/60d21c4f-21a3-4d94-85f4-b924e6aeeda4",
"name": "60d21c4f-21a3-4d94-85f4-b924e6aeeda4"
}Bylaw60d21c4f-21a3-4d94-85f4-b924e6aeeda4.bylaw.ps1 · 35 lines
# Converted from VirtualNetworkServiceEndpoint_StorageAccount_Audit.json by ConvertTo-Bylaw.
Policy '60d21c4f-21a3-4d94-85f4-b924e6aeeda4' {
Properties @{
DisplayName = 'Storage Accounts should use a virtual network service endpoint'
Description = 'This policy audits any Storage Account not configured to use a virtual network service endpoint.'
Version = '1.0.0'
Category = 'Network'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Storage/storageAccounts' {
Require 'networkAcls.defaultAction is Deny' {
Field networkAcls.defaultAction | Must -Be 'Deny'
}
Require 'networkAcls.virtualNetworkRules and id are as required' {
Count 'networkAcls.virtualNetworkRules[*]' -Where {
Field id | Must -Exist
} | Must -Not -Be 0
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Network/VirtualNetworkServiceEndpoint_StorageAccount_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw