Gallery › Storage › Azure built-in policies
Storage accounts should allow access from trusted Microsoft services
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
Some Microsoft services that interact with storage accounts operate from networks that can't be granted access through network rules. To help this type of service work as intended, allow the set of trusted Microsoft services to bypass the network rules. These services will then use strong authentication to access the storage account.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONStorageAccess_TrustedMicrosoftServices_Audit.json · 54 lines
{
"properties": {
"displayName": "Storage accounts should allow access from trusted Microsoft services",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Some Microsoft services that interact with storage accounts operate from networks that can't be granted access through network rules. To help this type of service work as intended, allow the set of trusted Microsoft services to bypass the network rules. These services will then use strong authentication to access the storage account.",
"metadata": {
"version": "1.0.0",
"category": "Storage"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "Audit",
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "The effect determines what happens when the policy rule is evaluated to match"
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Storage/storageAccounts"
},
{
"field": "Microsoft.Storage/storageAccounts/networkAcls.bypass",
"exists": "true"
},
{
"field": "Microsoft.Storage/storageAccounts/networkAcls.bypass",
"notContains": "AzureServices"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/c9d007d0-c057-4772-b18c-01e546713bcd",
"name": "c9d007d0-c057-4772-b18c-01e546713bcd"
}Bylawc9d007d0-c057-4772-b18c-01e546713bcd.bylaw.ps1 · 33 lines
# Converted from StorageAccess_TrustedMicrosoftServices_Audit.json by ConvertTo-Bylaw.
Policy 'c9d007d0-c057-4772-b18c-01e546713bcd' {
Properties @{
DisplayName = 'Storage accounts should allow access from trusted Microsoft services'
Description = 'Some Microsoft services that interact with storage accounts operate from networks that can''t be granted access through network rules. To help this type of service work as intended, allow the set of trusted Microsoft services to bypass the network rules. These services will then use strong authentication to access the storage account.'
Version = '1.0.0'
Category = 'Storage'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'The effect determines what happens when the policy rule is evaluated to match'
}
Resource 'Microsoft.Storage/storageAccounts' {
When {
Field networkAcls.bypass | Must -Exist
}
Require 'networkAcls.bypass contains AzureServices' {
Field networkAcls.bypass | Must -ContainText 'AzureServices'
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Storage/StorageAccess_TrustedMicrosoftServices_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw