AZ-500 · Question #450
Drag and Drop Question 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. How should you complete the…
The correct answer is Get-AzPolicyDefinition; New-AzPolicyAssignment. To assign an Azure Policy to a resource group using PowerShell, you first use Get-AzPolicyDefinition to retrieve the policy definition object (Policy1), which gives you the policy's details needed for assignment. Then you use New-AzPolicyAssignment to create the actual…
Question
Answer Area
Drag items
Correct arrangement
- Get-AzPolicyDefinition
- New-AzPolicyAssignment
Explanation
To assign an Azure Policy to a resource group using PowerShell, you first use Get-AzPolicyDefinition to retrieve the policy definition object (Policy1), which gives you the policy's details needed for assignment. Then you use New-AzPolicyAssignment to create the actual assignment of that policy to the scope of RG1, specifying the policy definition and the resource group's resource ID as the scope. This two-step approach - retrieve the definition, then create the assignment - is the standard PowerShell workflow for Azure Policy assignments.
Topics
Community Discussion
No community discussion yet for this question.