QuestionQ56

Secure Azure using Microsoft Defender for Cloud and Microsoft Sentinel

You have an Azure subscription that contains a resource group named RG1 and an Azure policy named Policy1.

You need to assign Policy1 to RG1.

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

Drag & Drop
$rg = Get-AzResourceGroup -Name 'RG1'

$Policy =  -Name 'Policy1'

 -Name 'AuditStorageAccounts' -PolicyDefinition $Policy -Scope $rg.ResourceID
Explanation

Get-AzPolicyDefinition retrieves the existing Policy1 definition. New-AzPolicyAssignment creates an assignment using that definition, and $rg.ResourceID scopes it to RG1.

Learn more

Community Discussion

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