Resource Graph Query
  • 19 Nov 2024
  • 2 Minutes 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.

Associating existing queries

Resource graph queries available in an Azure subscrption can be associated to a Business Application in a similar way as the other Azure resource types with the help of Add resources flow, Create Business Application flow and Edit Business Application flow.

Resource graph query.png

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 option.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

License consumption for resource graph queries 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.

Query.png

Updating an existing query

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

Update.png

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 button.png

Save query.png

Resource Dashboard

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

Resource dashboard.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.

Query monitoring.png


Was this article helpful?

What's Next