【发布时间】:2023-01-18 14:56:35
【问题描述】:
我正在尝试创建 Azure 自定义 RBAC,它在 action/noaction 中接受通配符,但是当我在 assinableScopes 中尝试通配符时它不起作用。
我需要限制某些资源组的权限,但我不知道资源组的确切名称。但是,我确实知道命名约定,并且我希望能够在 assinableScopes 中使用通配符。
我想做但 Azure 不允许的示例:
{
"properties": {
"roleName": "MySampleCustomRole",
"description": "My Sample Custom Role",
"assignableScopes": [
"/subscriptions/*/resourceGroups/ABCDXYZ-*"
],
"permissions": [{
"actions": [],
"notActions": [
"Microsoft.Compute/snapshots/delete",
"Microsoft.Compute/snapshots/write",
"Microsoft.Compute/snapshots/beginGetAccess/action",
"Microsoft.Compute/snapshots/endGetAccess/action",
"Microsoft.Compute/disks/beginGetAccess/action"
],
"dataActions": [],
"notDataActions": []
}
]
}
}
【问题讨论】:
-
除操作外,不能在角色中使用通配符。但是,您可以使用资源名称中的通配符通过 Azure Policy 分配角色。 Marco Laitinen 写了 a nice blog 关于通过策略分配 Azure 角色
-
@RoderickBant - 感谢您对政策驱动替代方案的建议和参考。策略可以成为救世主,但它必须依赖于资源组命名约定或标签。除非保持标签的完整性,否则使用标签进行 RBAC 分配是不明智的。太冒险了!为了进行比较,我们在 IAM 策略中使用通配符,您可以在资源定义中使用通配符。 Azure 应该与 AWS 相提并论,但 Azure 似乎落后于自定义 RBAC 功能!
标签: azure azure-rbac