Gallery › Storage › Azure built-in policies
Configure storage accounts to disable public network access
Converted Policy Disabled Modify Mode All Version 1.0.1
To improve the security of Storage Accounts, ensure that they aren't exposed to the public internet and can only be accessed from a private endpoint. Disable the public network access property as described in https://aka.ms/storageaccountpublicnetworkaccess. This option disables access from any public address space outside the Azure IP range, and denies all logins that match IP or virtual network-based firewall rules. This reduces data leakage risks.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
{
"properties": {
"displayName": "Configure storage accounts to disable public network access",
"policyType": "BuiltIn",
"mode": "All",
"description": "To improve the security of Storage Accounts, ensure that they aren't exposed to the public internet and can only be accessed from a private endpoint. Disable the public network access property as described in https://aka.ms/storageaccountpublicnetworkaccess. This option disables access from any public address space outside the Azure IP range, and denies all logins that match IP or virtual network-based firewall rules. This reduces data leakage risks.",
"metadata": {
"version": "1.0.1",
"category": "Storage"
},
"version": "1.0.1",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Modify",
"Disabled"
],
"defaultValue": "Modify"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Storage/storageAccounts"
},
{
"field": "Microsoft.Storage/storageAccounts/publicNetworkAccess",
"notEquals": "Disabled"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"conflictEffect": "audit",
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/17d1049b-9a84-46fb-8f53-869881c3d3ab"
],
"operations": [
{
"operation": "addOrReplace",
"field": "Microsoft.Storage/storageAccounts/publicNetworkAccess",
"value": "Disabled"
}
]
}
}
},
"versions": [
"1.0.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/a06d0189-92e8-4dba-b0c4-08d7669fce7d",
"name": "a06d0189-92e8-4dba-b0c4-08d7669fce7d"
}# Converted from StoragePublicNetworkAccess_Modify.json by ConvertTo-Bylaw.
Policy 'a06d0189-92e8-4dba-b0c4-08d7669fce7d' {
Properties @{
DisplayName = 'Configure storage accounts to disable public network access'
Description = 'To improve the security of Storage Accounts, ensure that they aren''t exposed to the public internet and can only be accessed from a private endpoint. Disable the public network access property as described in https://aka.ms/storageaccountpublicnetworkaccess. This option disables access from any public address space outside the Azure IP range, and denies all logins that match IP or virtual network-based firewall rules. This reduces data leakage risks.'
Version = '1.0.1'
Category = 'Storage'
PolicyVersion = '1.0.1'
Mode = 'All'
}
Parameter Effect @{
AllowedValues = @('Modify', 'Disabled')
Default = 'Modify'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Storage/storageAccounts' {
Require 'publicNetworkAccess is Disabled' {
Field publicNetworkAccess | Must -Be 'Disabled'
}
}
Modify -Role 'Storage Account Contributor' -ConflictEffect Audit -Effect (Param Effect) {
Field publicNetworkAccess | AddOrReplace 'Disabled'
}
}Source: built-in-policies/policyDefinitions/Storage/StoragePublicNetworkAccess_Modify.json in Azure/azure-policy, under the MIT licence.
Bylaw