Gallery › Compute › Azure Community Policy
allowed-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": "b339de02-b1a6-4ecb-badd-907b37e5374f",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "allowed-disk-skus",
"description": "need to add description",
"metadata": {
"category": "Compute",
"version": "1.0.0"
},
"mode": "All",
"parameters": {
"allowedDiskSkus": {
"type": "Array",
"metadata": {
"displayName": "Allowed Disk Skus",
"description": "The list of allowed 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/disks/sku.name",
"NotIn": "[parameters('allowedDiskSkus')]"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylawb339de02-b1a6-4ecb-badd-907b37e5374f.bylaw.ps1 · 32 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy 'b339de02-b1a6-4ecb-badd-907b37e5374f' {
Properties @{
DisplayName = 'allowed-disk-skus'
Description = 'need to add description'
Category = 'Compute'
Version = '1.0.0'
Mode = 'All'
}
Parameter AllowedDiskSkus @{
Type = 'Array'
DisplayName = 'Allowed Disk Skus'
Description = 'The list of allowed 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 one of the AllowedDiskSkus parameter' {
Field sku.name | Must -BeIn (Param AllowedDiskSkus)
}
}
Effect (Param Effect)
}Source: policyDefinitions/Compute/allowed-disk-skus/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw