除了某些用户之外,是否有任何内置角色拒绝在 az 订阅中创建资源的权限。一、
我使用了“不允许的资源类型”策略,但它适用于整个订阅。
最佳答案
我尝试在我的环境中重现相同的内容以拒绝在 Azure 中创建资源:
感谢Tiny Wang提出同样的建议。
- 将读者角色分配给用户或组,以限制Azure中的资源创建,如下所示。<
Azure 门户 > 订阅 > 选择您的订阅 > 访问控制 (IAM) > 添加 > 添加角色分配。
分配了读者角色。
当我尝试在订阅中创建Azure VM时,同一用户出现授权错误。
Note: if you create an Azure policy to deny the resource creation, the policy will apply to the scope level, not to users.
Ex: Subscription, Resource Groups
我已创建一个策略并将其分配给资源组范围,以拒绝在资源组内创建资源。
当我尝试创建任何资源时,出现策略限制错误。
Azure 策略规则:
{
"mode": "All",
"policyRule": {
"if": {
"field": "type",
"in": "[parameters('listOfResourcesTypesNotAllowed')]"
},
"then": {
"effect": "Deny"
}
},
"parameters": {
"listOfResourcesTypesNotAllowed": {
"type": "Array",
"metadata": {
"displayName": "Not Allowed Resources creation",
"description": "The list of resources type that cannot be deployed.",
"strongType": "resourceTypes"
}
}
}
}
关于azure - 如何拒绝除某些用户之外的 Azure 中创建资源的权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75331502/