Gallery › Storage › Azure Community Policy
storage-account-access-tier
Converted Policy Audit Deny Disabled Mode All Version 1.0.0
need to add description
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 52 lines
{
"name": "8589cbf6-c34b-425d-bbfb-7fad22d4dc74",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "storage-account-access-tier",
"description": "need to add description",
"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": "kind",
"in": [
"BlobStorage",
"StorageV2"
]
},
{
"field": "Microsoft.Storage/storageAccounts/accessTier",
"equals": "cool"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylaw8589cbf6-c34b-425d-bbfb-7fad22d4dc74.bylaw.ps1 · 31 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '8589cbf6-c34b-425d-bbfb-7fad22d4dc74' {
Properties @{
DisplayName = 'storage-account-access-tier'
Description = 'need to add description'
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 kind | Must -BeIn @('BlobStorage', 'StorageV2')
}
Require 'accessTier is not cool' {
Field accessTier | Must -Not -Be 'cool' -IfPresent
}
}
Effect (Param Effect)
}Source: policyDefinitions/Storage/storage-account-access-tier/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw