Gallery › Storage › Azure Community Policy
Storage Account - Trusted Azure Services DENY
Converted Policy Audit Deny Disabled Mode All Version 1.0.0
This Azure Policy denies the deployment of an Azure Storage Account when the 'Allow Azure services on the trusted services list to access this storage account' setting is set to 'Enabled'.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 49 lines
{
"name": "4f031cbb-b5f0-41ae-ab85-ca972ae1e3de",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Storage Account - Trusted Azure Services DENY",
"description": "This Azure Policy denies the deployment of an Azure Storage Account when the 'Allow Azure services on the trusted services list to access this storage account' setting is set to 'Enabled'.",
"metadata": {
"version": "1.0.0",
"category": "Storage"
},
"mode": "All",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Deny, Audit or Disabled the execution of the Policy"
},
"allowedValues": [
"Deny",
"Audit",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Storage/storageAccounts"
},
{
"field": "Microsoft.Storage/storageAccounts/networkAcls.bypass",
"exists": "true"
},
{
"field": "Microsoft.Storage/storageAccounts/networkAcls.bypass",
"contains": "AzureServices"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylaw4f031cbb-b5f0-41ae-ab85-ca972ae1e3de.bylaw.ps1 · 31 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '4f031cbb-b5f0-41ae-ab85-ca972ae1e3de' {
Properties @{
DisplayName = 'Storage Account - Trusted Azure Services DENY'
Description = 'This Azure Policy denies the deployment of an Azure Storage Account when the ''Allow Azure services on the trusted services list to access this storage account'' setting is set to ''Enabled''.'
Version = '1.0.0'
Category = 'Storage'
Mode = 'All'
}
Parameter Effect @{
AllowedValues = @('Deny', 'Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Deny, Audit or Disabled the execution of the Policy'
}
Resource 'Microsoft.Storage/storageAccounts' {
When {
Field networkAcls.bypass | Must -Exist
}
Require 'networkAcls.bypass does not contain AzureServices' {
Field networkAcls.bypass | Must -Not -ContainText 'AzureServices' -IfPresent
}
}
Effect (Param Effect)
}Source: policyDefinitions/Storage/storage-account-trusted-azure-services-deny/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw