Gallery › Storage › Azure Community Policy
Storage accounts should enable AAD authorization in the Azure portal
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
When this property is enabled, the Azure portal authorizes requests to blobs, queues, and tables with Azure Active Directory by default. It is disabled by default.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 45 lines
{
"name": "a92fad36-3505-4043-9b05-2e5875879369",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Storage accounts should enable AAD authorization in the Azure portal",
"description": "When this property is enabled, the Azure portal authorizes requests to blobs, queues, and tables with Azure Active Directory by default. It is disabled by default.",
"metadata": {
"version": "1.0.0",
"category": "Storage"
},
"mode": "Indexed",
"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/defaultToOAuthAuthentication",
"equals": "false"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylawa92fad36-3505-4043-9b05-2e5875879369.bylaw.ps1 · 27 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy 'a92fad36-3505-4043-9b05-2e5875879369' {
Properties @{
DisplayName = 'Storage accounts should enable AAD authorization in the Azure portal'
Description = 'When this property is enabled, the Azure portal authorizes requests to blobs, queues, and tables with Azure Active Directory by default. It is disabled by default.'
Version = '1.0.0'
Category = 'Storage'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Deny', 'Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Deny, Audit or Disabled the execution of the Policy'
}
Resource 'Microsoft.Storage/storageAccounts' {
Require 'defaultToOAuthAuthentication is not false' {
Field defaultToOAuthAuthentication | Must -Not -Be 'false' -IfPresent
}
}
Effect (Param Effect)
}Source: policyDefinitions/Storage/storage-accounts-should-enable-aad-authorization-in-the-azure-portal/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw