该任务的托管身份没有适当的权限来补救这些资源。编辑作业页面并重新删除

发布于 2025-02-09 20:52:16 字数 841 浏览 1 评论 0 原文

我需要从政策计划中创建政策分配并进行补救。我可以使用以下命令来创建分配。

$newRgAssignment = New-AzPolicyAssignment -Name $assigName -PolicySetDefinition $policySet -PolicyParameterObject $Params -AssignIdentity -Location 'westus' -scope $rgscope -DisplayName $assigName

在此,我可以成功创建作业。在尝试在Azure Portal中手动进行修复时,我可以在Azure门户中看到以下错误消息。

The managed identity for this assignment does not have the appropriate permissions to remediate these resources. To add these permissions, go to the Edit Assignment page for this Policy and re-save it.

我尝试通过传递系统设定的身份类型来创建策略分配,但遇到了相同的问题。

我只剩下一个选项,该选项是用户签名的身份类型。要传递此参数,我们需要获得分配的用户身份。为了获得用户身份,我使用了以下命令

Set-AzContext -Subscription 'XYZ-123-ABC'
$UserAssignedIdentity = Get-AzUserAssignedIdentity

,但没有用。

任何人都可以帮助我在这个问题上吗?任何帮助都可以应用。 谢谢。

I have a requirement of creating policy assignment from policy initiative and do remediation. I can create assignment using the below command.

$newRgAssignment = New-AzPolicyAssignment -Name $assigName -PolicySetDefinition $policySet -PolicyParameterObject $Params -AssignIdentity -Location 'westus' -scope $rgscope -DisplayName $assigName

In this I can create assignment successfully. while trying to remediation manually in I can see the below error message in azure portal .

The managed identity for this assignment does not have the appropriate permissions to remediate these resources. To add these permissions, go to the Edit Assignment page for this Policy and re-save it.

I tried creating a policy assignment by passing SystemAssigned identity type but ran into same problem.

I have left with only one option that is UserAssigned identity type. To pass this parameter we need to get the assigned user identity . To get the user identity I used the below commands

Set-AzContext -Subscription 'XYZ-123-ABC'
$UserAssignedIdentity = Get-AzUserAssignedIdentity

But no use.

Can any one help me on this issue. Any help can be appriciated.
Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ぃ弥猫深巷。 2025-02-16 20:52:16

tenantid'xxxx-xxxx-xxxx-xxxx'包含多个活动
订阅。第一个将选择进一步使用。选择
另一个订阅,使用Set-azContext。这不是任何错误。它是
警告。 get-azuserAssignedIdentity命令返回null。

安装模块 az.managedSericeSidentity 后,我们尝试使用以下CMD尝试,并能够获得结果。

警告您可能会收到,但在 set-azcontext -subscription'xyz-123-abc'之后
它将登录您想要的正确订阅。

成功登录类型 $ userAssignedIdentity ,即使您在该订阅中具有用户角色

有关更多信息,请参阅以下链接: -

TenantId 'xxxx-xxxx-xxxx-xxxx' contains more than one active
subscription. First one will be selected for further use. To select
another subscription, use Set-AzContext. This is not any error. Its a
warning. Get-AzUserAssignedIdentity command returning null.

We have tried with below cmd after installing module Az.ManagedSericeIdentity and can able to get the results.

Warning you might receive but after Set-AzContext -Subscription 'XYZ-123-ABC'
it will be logged into the correct subscription you wanted to.

enter image description here

After successfully login type $UserAssignedIdentity even if you have user role to that subscription.

enter image description here

For more information please refer the below links:-

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文