az policy assignment identity
管理策略分配的托管标识。
命令
| 名称 | 说明 | 类型 | Status |
|---|---|---|---|
| az policy assignment identity assign |
将系统分配的标识或用户分配的标识添加到策略分配。 |
Core | GA |
| az policy assignment identity remove |
从策略分配中删除托管标识。 |
Core | GA |
| az policy assignment identity show |
显示策略分配的托管标识。 |
Core | GA |
az policy assignment identity assign
替换现有标识将在资源命令的未来版本中发生更改。 它首先需要删除现有标识。
将系统分配的标识或用户分配的标识添加到策略分配。
az policy assignment identity assign --name
[--identity-scope]
[--resource-group]
[--role]
[--scope]
[--system-assigned]
[--user-assigned]
示例
将系统分配的托管标识添加到策略分配。
az policy assignment identity assign --system-assigned -g MyResourceGroup -n MyPolicyAssignment
将系统分配的托管标识添加到策略分配,并向其授予当前资源组的“参与者”角色。
az policy assignment identity assign --system-assigned -g MyResourceGroup -n MyPolicyAssignment --role Contributor --identity-scope /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup
将用户分配的托管标识添加到策略分配。
az policy assignment identity assign --user-assigned MyAssignedId -g MyResourceGroup -n MyPolicyAssignment
必需参数
策略分配的名称。
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
系统分配的标识可以访问的范围。
| 属性 | 值 |
|---|---|
| Parameter group: | Managed Identity Arguments |
将应用策略的资源组。
将分配给托管标识的角色名称或 ID。
| 属性 | 值 |
|---|---|
| Parameter group: | Managed Identity Arguments |
| 默认值: | Contributor |
此策略分配子命令适用的范围。 默认为当前上下文订阅。
提供此标志以使用系统分配标识进行策略分配。 请查看有关更多示例的帮助。
| 属性 | 值 |
|---|---|
| Parameter group: | Managed Identity Arguments |
要用于策略分配的 UserAssigned 标识 ID。 请查看有关更多示例的帮助。
| 属性 | 值 |
|---|---|
| Parameter group: | Managed Identity Arguments |
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
az policy assignment identity remove
在资源命令的未来版本中,删除用户分配的标识将发生更改。 它需要提供 --mi-user-assigned 开关。
从策略分配中删除托管标识。
az policy assignment identity remove --name
[--resource-group]
[--scope]
必需参数
策略分配的名称。
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
将应用策略的资源组。
此策略分配子命令适用的范围。 默认为当前上下文订阅。
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
az policy assignment identity show
显示策略分配的托管标识。
az policy assignment identity show --name
[--resource-group]
[--scope]
示例
显示策略分配的托管标识。 (autogenerated)
az policy assignment identity show --name MyPolicyAssignment --scope '/providers/Microsoft.Management/managementGroups/MyManagementGroup'
必需参数
策略分配的名称。
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
将应用策略的资源组。
此策略分配子命令适用的范围。 默认为当前上下文订阅。
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |