'How to remediate a policy assignment for an initiative definition?

  • Managed Identity: Tag Contributor (via Powershell)
  • Scope: Resource Group in one Sub
  • Effect: Modify (Operation Add)
  • Related Built-in Policy Def: Add a tag to a resource group

This Policy Def has been placed in an initiative. The role assignment has been added to a resource group. The Policy Assignment for is scoped at one resource group. When I start a remediation task through powershell, it succeeds, and the operation is logged as successful in the portal. However, no tag is added to the resource group [1]. Is this Powershell cmdlet correct to remediate a tag with Tag Contributor? It seems to work for a policy assignment with one definition, but not for a policy assignment with a defintion in an initiative, unless the assignment is made contributor.

Start-AzPolicyRemediation -ResourceGroupName "myRG" -PolicyAssignmentId $policyAssignmentId -PolicyDefinitionReferenceId "0349234412441" -Name "remediation1"

[1] https://docs.microsoft.com/en-us/powershell/module/az.policyinsights/start-azpolicyremediation?view=azps-7.2.0



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source