0
votes

I am able to assign a Azure policy using command "New-AzPolicyAssignment". Below is the document which have information about this.

https://docs.microsoft.com/en-us/powershell/module/az.resources/new-azpolicysetdefinition?view=azps-2.1.0

But i want to assign policy set, how can i assign policy set using Powershell?

1

1 Answers

1
votes

I found the answer for this.

 Connect-AzAccount -Subscription "subscriptionidhere"
    $PolicySet = Get-AzPolicySetDefinition -Name "plociysetguidhere"
    New-AzPolicyAssignment -Name 'Name here' -PolicySetDefinition $PolicySet -Scope "/subscriptions/subscriptionidhere"

You can find the Policy set Guid by just running the "Get-AzPolicySetDefinition", this will pull all the policy sets for your subscription