azure - 使用 Azure 策略拒绝 Azure 磁盘加密解密/禁用
问题描述
我正在尝试创建拒绝策略来拒绝磁盘解密(通过 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 操作系统和数据磁盘上使用锁定的任何意外问题。
解决方案
您是否尝试过包含 Microsoft.Compute/disks/encryption.type 或 Microsoft.Compute/disks/encryption 别名?在我现有的资源中,这是与加密相关的唯一别名。
推荐阅读
- unity3d - LeapMotion unity 4.0 是否还支持检测工具,比如铅笔?
- android - 设置颜色过滤器不适用于自定义颜色
- javascript - Bootstrap 卡中的响应式 PlotlyJS 图表
- scala - Scala 隐式类(在隐式类中使用隐式) - 不是 Int 错误的成员
- excel - 如何对列进行字母排序和其他特定排序?
- airflow - Airflow Web UI 上的管理菜单中没有连接标签
- flutter - 点击打开和折叠下拉菜单时颤动
- javascript - 使用 React 使整个 div 表现得像一个复选框
- excel - 在保存事件上创建页眉和页脚。检查页眉或页脚是否存在
- sql - Oracle Rest Data Services PDF 打印错误