我正在尝试创建一个拒绝策略以拒绝磁盘解密(通过Azure磁盘加密进行加密),但是该拒绝未生效。我确实看到磁盘不符合要求。
以下是政策:
{
"properties": {
"displayName": "Prevent disk decryption on virtual machines",
"policyType": "Custom",
"mode": "All",
"description": "VMs once encrypted, should not be allowed to be decrypted",
"metadata": {
"category": "Compute",
"createdBy": "454393d8-e9f1-424d-8054-52d45c90cf6c",
"createdOn": "2019-08-12T15:35:43.7697071Z",
"updatedBy": "454393d8-e9f1-424d-8054-52d45c90cf6c",
"updatedOn": "2019-08-12T18:41:36.6828893Z"
},
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Deny",
"Disabled",
"Audit"
],
"defaultValue": "Deny"
}
},
"policyRule": {
"if": {
"anyOf": [
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/disks"
},
{
"field": "Microsoft.Compute/disks/encryptionSettingsCollection.enabled",
"notequals": "true"
}
]
},
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/disks"
},
{
"field": "Microsoft.Compute/disks/encryptionSettings.enabled",
"notequals": "true"
}
]
},
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/virtualMachines"
},
{
"field": "Microsoft.Compute/virtualMachines/storageProfile.osDisk.encryptionSettings.enabled",
"notequals": "true"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
},
"type": "Microsoft.Authorization/policyDefinitions",
"name": "ce6bfec6-c4db-46e0-a475-baf5b81063fc"
}
我认为它不符合要求,但“拒绝”无效。我仍然可以运行“ az vm加密禁用”。是Lock前往这里的方式吗?在VM OS和数据磁盘上使用锁定的任何意外问题。
答案 0 :(得分:0)
您是否尝试过包含Microsoft.Compute / disks / encryption.type或Microsoft.Compute / disks / encryption别名?在我现有的资源中,这是与加密有关的唯一别名。