Skip to content

Files

Latest commit

c58cc6b · Mar 12, 2019

History

History
This branch is 17995 commits behind Azure/azure-quickstart-templates:master.

101-azurepolicy-assign-builtinpolicy-resourcegroup

Assign a built-in policy to an existing Resource Group

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