QuestionQ80

VerifiedSecure Azure using Microsoft Defender for Cloud and Microsoft Sentinel

You have two Azure subscriptions named Sub1 and Sub2. Sub1 contains a resource group named RG1 and an Azure policy named Policy1.

You need to remediate the non-compliant resources in Sub1 based on Policy1.

Complete the PowerShell script. Each value may be used once, more than once, or not at all.

Drag & Drop
$policyAssignmentI = "/subscriptions/f0710c27-9663-4c05-19f8-1b4be01e86a5/providers/Microsoft.Authorization/policyAssignments/2deae24764b447c29af7c309"

 -Subscription “Sub1”

 -PolicyAssignmentId $policyAssignmentId -Name “Policy1” -ResourceDiscoveryMode ReEvaluateCompliance
Explanation

Set-AzContext selects Sub1 for the PowerShell session. Start-AzPolicyRemediation creates a remediation task for the policy assignment, and ReEvaluateCompliance refreshes compliance discovery before the task runs. Start-AzPolicyComplianceScan only starts a compliance evaluation; it does not remediate resources.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!