Gallery › Compute › Azure Community Policy
blocked-disk-skus
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": "38dfed9b-a4e8-4c1e-9842-4a56eb19574d",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "blocked-disk-skus",
"description": "need to add description",
"metadata": {
"category": "Compute",
"version": "1.0.0"
},
"mode": "All",
"parameters": {
"blockedDiskSkus": {
"type": "Array",
"metadata": {
"displayName": "Blocked Disk Skus",
"description": "The list of blocked disk skus for Managed Disks."
}
},
"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.Compute/disks"
},
{
"field": "Microsoft.Compute/disk/sku.name",
"in": "[parameters('blockedDiskSkus')]"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylaw38dfed9b-a4e8-4c1e-9842-4a56eb19574d.bylaw.ps1 · 32 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '38dfed9b-a4e8-4c1e-9842-4a56eb19574d' {
Properties @{
DisplayName = 'blocked-disk-skus'
Description = 'need to add description'
Category = 'Compute'
Version = '1.0.0'
Mode = 'All'
}
Parameter BlockedDiskSkus @{
Type = 'Array'
DisplayName = 'Blocked Disk Skus'
Description = 'The list of blocked disk skus for Managed Disks.'
}
Parameter Effect @{
AllowedValues = @('Deny', 'Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Deny, Audit or Disabled the execution of the Policy'
}
Resource 'Microsoft.Compute/disks' {
Require 'sku.name is not one of the BlockedDiskSkus parameter' {
Field 'Microsoft.Compute/disk/sku.name' -AllowUnknownAlias | Must -Not -BeIn (Param BlockedDiskSkus) -IfPresent
}
}
Effect (Param Effect)
}Source: policyDefinitions/Compute/blocked-disk-skus/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw