Gallery › Storage › Azure Community Policy
restrict-container-immutability-period
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 · 45 lines
{
"name": "157d2d95-1fe3-472e-bfcb-23db0acb80f9",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "restrict-container-immutability-period",
"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/blobServices/containers/immutabilityPolicies"
},
{
"field": "Microsoft.Storage/storageAccounts/blobServices/containers/immutabilityPolicies/default.immutabilityPeriodSinceCreationInDays",
"greater": 30
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylaw157d2d95-1fe3-472e-bfcb-23db0acb80f9.bylaw.ps1 · 27 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '157d2d95-1fe3-472e-bfcb-23db0acb80f9' {
Properties @{
DisplayName = 'restrict-container-immutability-period'
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/blobServices/containers/immutabilityPolicies' {
Require 'default.immutabilityPeriodSinceCreationInDays is at most 30' {
Field default.immutabilityPeriodSinceCreationInDays | Must -BeLessOrEqual 30 -IfPresent
}
}
Effect (Param Effect)
}Source: policyDefinitions/Storage/restrict-container-immutability-period/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw