Gallery › Storage › Azure Community Policy
Storage Account - Trusted Azure Services AUDIT
Converted Policy Audit Disabled Mode All Version 1.0.0
This Azure Policy creates an audit event 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 · 48 lines
{
"name": "c56bf0c0-18b6-4659-a4b7-066056986982",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Storage Account - Trusted Azure Services AUDIT",
"description": "This Azure Policy creates an audit event 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": "Audit or Disabled the execution of the Policy"
},
"allowedValues": [
"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')]"
}
}
}
}Bylawc56bf0c0-18b6-4659-a4b7-066056986982.bylaw.ps1 · 31 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy 'c56bf0c0-18b6-4659-a4b7-066056986982' {
Properties @{
DisplayName = 'Storage Account - Trusted Azure Services AUDIT'
Description = 'This Azure Policy creates an audit event 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 = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = '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-audit/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw