Resource Graph Query
  • 23 Feb 2024
  • 1 Minute to read
  • Dark
    Light
  • PDF

Resource Graph Query

  • Dark
    Light
  • PDF

Article Summary

Introduction

Azure Resource Graph is an Azure service intended to manage Azure resource(s) by providing highly responsive resource exploration. It offers a unified API and a potent query language that lets you quickly and effectively retrieve data about your resources across a specified set of subscriptions.

Use Case Scenario

Here's a real-time example of an Azure Resource Graph query:

resourcechanges

| where properties.changeType == "Delete" and properties.changeAttributes.timestamp > ago(1d)

This query retrieves information about Azure resources that have been deleted in the last day.

Let's break down this query:

  • 'resourcechanges': This is the table in Azure Resource Graph that contains information about all Azure resources that have been created, updated (or) deleted.
  • where properties.changeType == "Delete" and properties.changeAttributes.timestamp > ago(1d): This selects the resource types deleted in the last day.

As a result of the above query, users can easily identify deleted resources and get their complete information, such as resource name and type.

This is a simple example, but Azure Resource Graph can handle much more complicated queries involving multiple tables and advanced filtering and aggregation techniques.

Creating a query

  • A resource graph query can be created in a Business Application by using the Add dropdown in the Resources section of a Business Application.

Add.png

  • You can also create it from the Resource Graph Queries section if there is any existing resource graph query associated.

Add dropdown.png

  • Give the query a unique name and an optional description. Enter the query and select the Azure subscription and resource group to which the query should be assigned as an Azure resource.

Create query.png

The resource graph license consumption works similar to other Azure resource types.

Executing a query

Provide valid query data and hit the Run button. Different chart types can be used to display the query results.

Execute query.png

Updating an existing query

The Update button allows the addition of new query data to an existing resource graph query.

Update query.gif

Saving a new query from an existing one

A resource graph query can be created from an existing one by executing a new query in it and clicking the Save button.

Save query.gif

Resource Dashboard

Users can keep track of the query results by using a dashboard to visualize the resource graph query.

Dashboards.png

Query Monitoring

The associated resource graph queries can be monitored by configuring rules to it in Monitoring section. The threshold values can be specified based on users needs.

Resource graph - query monitoring.gif


Was this article helpful?

What's Next