@Mansi Sharma Here is sample code on how to remediate non-compliant resources using python sdk. Do check it out and revert if you have further questions.
How to remediate non-compliant resource through python sdk
Hi,
I am creating policy definitions through Python SDK for creating diagnostic setting for all the resources of a particular type and I want to remediate non-compliant resources. Through UI I am able to create remediation task but when do it through SDK it is not working.. below is the code I used for creating remediation task ,can anyone point out what is that I am missing in this code?
remediation=Remediation(policy_assignment_id=policyAssignRes.id,policy_definition_reference_id=policyDefinitionRes.id,resource_discovery_mode=ResourceDiscoveryMode.EXISTING_NON_COMPLIANT,filters=RemediationFilters(locations=list("eastus2")))
remediationOptr=policyInsightsClient.remediations
remediationOptrRes=remediationOptr.create_or_update_at_subscription(remediation_name="Remidiations task for xyz resource", parameters=remediation)