Gallery › Storage › Azure built-in policies
Storage accounts should prevent shared key access (excluding storage accounts managed by Azure Red Hat OpenShift)
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
Audit requirement of Azure Active Directory (Azure AD) to authorize requests for your storage account. By default, requests can be authorized with either Azure Active Directory credentials, or by using the account access key for Shared Key authorization. Of these two types of authorization, Azure AD provides superior security and ease of use over Shared Key, and is recommended by Microsoft. Storage accounts in resource groups managed by Azure Red Hat OpenShift are excluded from evaluation.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
{
"properties": {
"displayName": "Storage accounts should prevent shared key access (excluding storage accounts managed by Azure Red Hat OpenShift)",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Audit requirement of Azure Active Directory (Azure AD) to authorize requests for your storage account. By default, requests can be authorized with either Azure Active Directory credentials, or by using the account access key for Shared Key authorization. Of these two types of authorization, Azure AD provides superior security and ease of use over Shared Key, and is recommended by Microsoft. Storage accounts in resource groups managed by Azure Red Hat OpenShift are excluded from evaluation.",
"metadata": {
"version": "1.0.0",
"category": "Storage"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "The effect determines what happens when the policy rule is evaluated to match"
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Storage/storageAccounts"
},
{
"value": "[resourcegroup().managedBy]",
"notContains": "/providers/Microsoft.RedHatOpenShift/"
},
{
"anyOf": [
{
"field": "Microsoft.Storage/storageAccounts/allowSharedKeyAccess",
"exists": "false"
},
{
"field": "Microsoft.Storage/storageAccounts/allowSharedKeyAccess",
"notEquals": "false"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/05f95bb8-8ef8-4cef-8cad-5d30f9912850",
"name": "05f95bb8-8ef8-4cef-8cad-5d30f9912850"
}# Converted from StorageAccountAllowSharedKeyAccessWithAROExcluded_Audit.json by ConvertTo-Bylaw.
Policy '05f95bb8-8ef8-4cef-8cad-5d30f9912850' {
Properties @{
DisplayName = 'Storage accounts should prevent shared key access (excluding storage accounts managed by Azure Red Hat OpenShift)'
Description = 'Audit requirement of Azure Active Directory (Azure AD) to authorize requests for your storage account. By default, requests can be authorized with either Azure Active Directory credentials, or by using the account access key for Shared Key authorization. Of these two types of authorization, Azure AD provides superior security and ease of use over Shared Key, and is recommended by Microsoft. Storage accounts in resource groups managed by Azure Red Hat OpenShift are excluded from evaluation.'
Version = '1.0.0'
Category = 'Storage'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
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 {
Arm '[resourcegroup().managedBy]' | Must -Not -ContainText '/providers/Microsoft.RedHatOpenShift/'
}
Require 'allowSharedKeyAccess exists' {
Field allowSharedKeyAccess | Must -Exist
}
Require 'allowSharedKeyAccess is false' {
Field allowSharedKeyAccess | Must -Be 'false'
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Storage/StorageAccountAllowSharedKeyAccessWithAROExcluded_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw