Azure / azure-policy

Repository for Azure Resource Policy built-in definitions and samples
MIT License
1.51k stars 1.09k forks source link

Start-AzPolicyRemediation: InvalidUpdateRemediationRequest #1234

Open hoppipola004 opened 1 year ago

hoppipola004 commented 1 year ago

We are trying to remediate policies on and we're failing with error:

Start-AzPolicyRemediation : Operation returned an invalid status code 'BadRequest' (InvalidUpdateRemediationRequest: The request to update remediation 'e219XXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXXX' is invalid. A remediation may not be changed or replaced while it is active.) At line:61 char:33 + ... Start-AzPolicyRemediation -ManagementGroupName $mgid -Pol ... + ~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Start-AzPolicyRemediation], RestException + FullyQualifiedErrorId : Microsoft.Azure.Commands.PolicyInsights.Cmdlets.Remediation.StartAzureRmPolicyRemediation

Start-AzPolicyRemediation -ManagementGroupName $mgid -PolicyAssignmentId $policyAssignment.PolicyAssignmentId -PolicyDefinitionReferenceId $definition.policyDefinitionReferenceId -Name $guid.Guid

hoppipola004 commented 1 year ago

Id : /providers/microsoft.management/managementgroups/xx-xxx/providers/microsoft.policyinsights /remediations/e219XXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXXX Type : Microsoft.PolicyInsights/remediations Name : e219XXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXXX PolicyAssignmentId : /providers/microsoft.management/managementgroups/mg-azr/providers/microsoft.authorization/ policyassignments/xx.pri.xxx-01 PolicyDefinitionReferenceId : pr.azr.security_mgmt.005.prd CreatedOn : 10/31/2023 8:33:35 AM LastUpdatedOn : 10/31/2023 8:33:35 AM ProvisioningState : Succeeded Filters : DeploymentSummary : Microsoft.Azure.Commands.PolicyInsights.Models.Remediation.PSRemediationDeploymentSummary Deployments : ResourceDiscoveryMode : ExistingNonCompliant ResourceCount : ParallelDeployments : FailureThreshold : CorrelationId : d8687078-600e-466a-a982-0e0a4b3c59b4 StatusMessage :

Id : /providers/microsoft.management/managementgroups/xx-xxx/providers/microsoft.policyinsights /remediations/e219XXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXXX Type : Microsoft.PolicyInsights/remediations Name : e219XXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXXX PolicyAssignmentId : /providers/microsoft.management/managementgroups/mg-azr/providers/microsoft.authorization/ policyassignments/nn.pri.dfc-01 PolicyDefinitionReferenceId : pr.azr.security_mgmt.009.prd CreatedOn : 10/31/2023 8:33:37 AM LastUpdatedOn : 10/31/2023 8:33:37 AM ProvisioningState : Accepted Filters : DeploymentSummary : Microsoft.Azure.Commands.PolicyInsights.Models.Remediation.PSRemediationDeploymentSummary Deployments : ResourceDiscoveryMode : ExistingNonCompliant ResourceCount : ParallelDeployments : FailureThreshold : CorrelationId : f6818889-8420-47e9-88eb-ccb24ffa119e StatusMessage :