Open In App

Microsoft Azure – Using KQL in Various Methods With Azure Tools

Last Updated : 03 Apr, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Here in this article, you will be learning about various methods of using Kusto queries or KQL queries in different methods to retrieve the resource properties. Before we get into examples, let see what is Kusto Query Language.

Kusto Query Language, also known as KQL. It is an Azure native tool to explore your data and discover patterns, identify anomalies and outliers, create graphs, pie and bar charts for visual representation, and more. KQL is a very powerful tool to explore data and view data in the table format. KQL is easy to learn, and its syntax is very similar to SQL. 

Let’s get started with some examples using various azure native tools.

Below are some examples of finding the Count of Azure Key Vault using the Azure native tools like Resource Graph Explorer, Azure CLI cmdlet, and Azure PowerShell cmdlet.

Method 1: Using KQL Find the count of Azure Key Vaults resources using Resource Graph Explorer

Resources
| where type =~ 
'microsoft.keyvault/vaults'
| count

or Single Line Syntax separated by Pipe ‘|’

Resources | where type =~ 
'microsoft.keyvault/vaults' | count

This query returns the count of Azure Key Vaults from the select scope. Refer to the below output.

Output:

Azure Resource Graph Explorer

 

Method 2: Using Azure CLI Find the Count of Azure Key Vaults using the az graph query cmdlet.

az graph query -q "Resources | 
where type =~ 'microsoft.keyvault
/vaults' | count"

This az command returns the count of Azure Key Vaults. Refer to the below output.

Output:

 

Method 3: Using Azure PowerShell Finding the count of Azure Key Vaults using the Search-AzGraph cmdlet

Search-AzGraph -Query "Resources 
| where type =~ 'microsoft.keyvault
/vaults' | count"

This Azure PowerShell command returns the count of Azure Key Vaults. Refer to the below output.

Output:

 


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

Similar Reads