Gallery › Storage › Azure Landing Zones Library
Encryption for storage services should be enforced for Storage Accounts
Converted Policy Audit Deny Disabled Mode All Version 1.0.0
Azure Storage accounts should enforce encryption for all storage services. Enforce this for increased encryption scope.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONDeny-Storage-ServicesEncryption.alz_policy_definition.json · 100 lines
{
"name": "Deny-Storage-ServicesEncryption",
"properties": {
"description": "Azure Storage accounts should enforce encryption for all storage services. Enforce this for increased encryption scope.",
"displayName": "Encryption for storage services should be enforced for Storage Accounts",
"metadata": {
"alzCloudEnvironments": [
"AzureCloud",
"AzureChinaCloud",
"AzureUSGovernment"
],
"category": "Storage",
"source": "https://github.com/Azure/Enterprise-Scale/",
"version": "1.0.0"
},
"mode": "All",
"parameters": {
"effect": {
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Deny",
"metadata": {
"description": "Enable or disable the execution of the policy",
"displayName": "Effect"
},
"type": "String"
}
},
"policyRule": {
"if": {
"allOf": [
{
"equals": "Microsoft.Storage/storageAccounts",
"field": "type"
},
{
"anyOf": [
{
"anyOf": [
{
"exists": "false",
"field": "Microsoft.Storage/storageAccounts/encryption.services.blob.enabled"
},
{
"field": "Microsoft.Storage/storageAccounts/encryption.services.blob.enabled",
"notEquals": true
}
]
},
{
"anyOf": [
{
"exists": "false",
"field": "Microsoft.Storage/storageAccounts/encryption.services.file.enabled"
},
{
"field": "Microsoft.Storage/storageAccounts/encryption.services.file.enabled",
"notEquals": true
}
]
},
{
"anyOf": [
{
"exists": "false",
"field": "Microsoft.Storage/storageAccounts/encryption.services.queue.keyType"
},
{
"field": "Microsoft.Storage/storageAccounts/encryption.services.queue.keyType",
"notEquals": "Account"
}
]
},
{
"anyOf": [
{
"exists": "false",
"field": "Microsoft.Storage/storageAccounts/encryption.services.table.keyType"
},
{
"field": "Microsoft.Storage/storageAccounts/encryption.services.table.keyType",
"notEquals": "Account"
}
]
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"policyType": "Custom"
},
"type": "Microsoft.Authorization/policyDefinitions"
}BylawDeny-Storage-ServicesEncryption.bylaw.ps1 · 44 lines
# Converted from Deny-Storage-ServicesEncryption.alz_policy_definition.json by ConvertTo-Bylaw.
Policy 'Deny-Storage-ServicesEncryption' {
Properties @{
DisplayName = 'Encryption for storage services should be enforced for Storage Accounts'
Description = 'Azure Storage accounts should enforce encryption for all storage services. Enforce this for increased encryption scope.'
Category = 'Storage'
Version = '1.0.0'
Mode = 'All'
Metadata = [ordered]@{ alzCloudEnvironments = @('AzureCloud', 'AzureChinaCloud', 'AzureUSGovernment'); source = 'https://github.com/Azure/Enterprise-Scale/' }
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Deny'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Storage/storageAccounts' {
Require 'encryption.services.blob.enabled exists and is true' {
Field encryption.services.blob.enabled | Must -Exist
Field encryption.services.blob.enabled | Must -Be $true
}
Require 'encryption.services.file.enabled exists and is true' {
Field encryption.services.file.enabled | Must -Exist
Field encryption.services.file.enabled | Must -Be $true
}
Require 'encryption.services.queue.keyType exists and is Account' {
Field encryption.services.queue.keyType | Must -Exist
Field encryption.services.queue.keyType | Must -Be 'Account'
}
Require 'encryption.services.table.keyType exists and is Account' {
Field encryption.services.table.keyType | Must -Exist
Field encryption.services.table.keyType | Must -Be 'Account'
}
}
Effect (Param Effect)
}Source: policy_definitions/Deny-Storage-ServicesEncryption.alz_policy_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.
Bylaw