Open In App

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

Last Updated : 30 Mar, 2023
Like Article

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)


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.


Similar Reads

Microsoft Azure - Get Azure Policies Definitions and Policy Initiatives Definitions
In this article, we will be using some Azure PowerShell Commands either in Azure Cloud Shell or in Azure PowerShell ISE in Admin mode to get the details and properties about the Azure Policies. Let's get started. 1. Use the Get-AzPolicyStateSummary PowerShell command to get the details of the azure policy compliance status of Non-Compliant Resource
1 min read
Microsoft Azure - Get Azure VM Properties using Azure PowerShell
The purpose of using the Azure PowerShell Commands is to quickly analyze the overall properties of VM/VMs at once the filtering the with select and where conditions. To find the properties of an Azure VM, you can perform the following commands in Azure Cloud Shell to get the details. Command: Get-AzVM Output: 1. Get all properties of an Azure Virtu
2 min read
Microsoft Azure - Check Status of Azure VM using Azure PowerShell
The following Azure PowerShell command helps you to find the Azure VM Config and properties details of Os Name, Os Version, Hyper V Generation, Disks properties, Extensions properties of Type Handler Version, Status and Message, VM Agents properties of Type Handler Version, Status and Message and also VM Power Status Codes, Messages, Plugins, Time
3 min read
Microsoft Azure - Manage Azure VMs using Azure PowerShell Commands
Here we are using Azure PS Commands to manage azure resources from Azure Cloud Shell or by using Windows PowerShell. By using the simple AZ PS command we can manage Azure VM Quicks without any efforts of navigating in Azure Portal and at Scale. Let's get started by using the major Azure PS commands to manage Azure Virtual Machine. 1. Start a Specif
2 min read
Microsoft Azure - Creating Custom Policy Initiative using PowerShell
In this article we'll see how we can create an Azure Custom Policy Initiative Definition with a JSON file using the Azure PowerShell commands in simple easy steps. What is Custom Policy Initiative Definition? Custom Policy Initiative is a collection or group of policy definitions that are grouped to apply policies together for a specific organizati
2 min read
Microsoft Azure - Azure Managed Disk State Details using PowerShell
In this article, we will try to understand how we can fetch the VM Disk State by using the Azure PowerShell Commands. With the help of the Azure PowerShell Commands, we will be finding the Managed Disk State of Unattached, Attached, and Reserved of all the Azure VM Disks within Subscription. Implementation: Follow the below steps to get azure manag
1 min read
Microsoft Azure - Azure App Servers Routing using PowerShell
In this article, we will look into how to add logic to your testing and production sites with PowerShell. I Azure, you could split the traffic that goes between your staging slot on your production slot by defining routing rules inside the Azure portal. Now, what if you wanted to do this programmatically via maybe a PowerShell script. One of the th
2 min read
How to Export Definitions in an Azure Initiative Policy to CSV File?
An Azure Policy Initiative Definition is a collection of Azure Policy definitions that are grouped together. Here in this article, we will show how to export Azure policy definitions that are listed in an Azure policy initiative. We will be using the Azure Resource Graph KQL query to export the Azure Policy definitions that are grouped together in
3 min read
Microsoft Azure - Pre-built Azure VMs
In this article, we will learn how to get started with Prebuilt Azure Virtual Machines ready for containers. If you wanted to get started with Docker, and you're thinking if there were some VMs that had already been set up with Docker and some images for you to try out, then you should definitely check out the VMs that are available inside the Azur
2 min read
How to Configure Azure Activity "Administrative" Logs on Azure Subscription using PowerShell?
Azure Activity "Administrative" logs are a type of activity log that record events that occur in your Azure subscription. By enabling and configuring the Azure Activity "Administrative" logs will collect and store logs in your specified log analytics workspace (this is your log destination). Administrative logs help you to view and analyze the logs
3 min read