Open In App

Microsoft Azure – Built-in Policy Definitions and It’s Count using PowerShell

Last Updated : 30 Mar, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

In this article, we will see how we can get the azure built-in policy definitions with their display names and also the count of policy definitions within the select scope in Azure using the Azure PowerShell commands. The purpose of finding to know the policy definition and count which is being applied on the select scope. So, that users can add or exclude the policy definitions according to their project needs. Here the scope represents Subscription, Resource Group, or a Resource.

Azure Built-in Policy Definitions:

Use the below following command on azure cloud shell or Windows PowerShell to get the Azure Policy Definitions list within the subscription.

Get-AzPolicyDefinition -Builtin | select -ExpandProperty Properties `
| select Displayname

This command returns the Policy Definitions Display Names within the select scope. (Refer below Output)

Output:

Built-in Policy Definitions Count at Select Scope:

Use the below following command to find the overall count of policy definitions within the select scope.

(Get-AzPolicyDefinition -Builtin | select -ExpandProperty Properties | select Displayname).count

this command returns the total count of Built-in Policy Definitions.

Output:


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads