This template assigns a built-in policy to an existing resource group. You must be an owner of the subscription to apply a policy at this scope. Inputs to this template are following fields:
- policyDefinitionID
- policyAssignmentName
The following PowerShell script shows how to get the policy definition ID and the policy display name of a built-in policy called "Audit resource location matches resource group location".
PS C:\> $definition = Get-AzPolicyDefinition | Where-Object { $_.Properties.DisplayName -eq 'Audit resource location matches resource group location' }
$policyDefinitionID = $definition.PolicyDefinitionId