Microsoft.ResourceGraph queries

The queries resource type can be deployed to: Resource groups.

To learn about resource group deployments, see Bicep or ARM template.

For a list of changed properties in each API version, see change log.

Template format

To create a Microsoft.ResourceGraph/queries resource, add the following Bicep or JSON to your template.

resource symbolicname 'Microsoft.ResourceGraph/queries@2018-09-01-preview' = {
  name: 'string'
  location: 'string'
  tags: {
    tagName1: 'tagValue1'
    tagName2: 'tagValue2'
  }
  etag: 'string'
  properties: {
    description: 'string'
    query: 'string'
  }
}

Property values

queries

Name Description Value
type The resource type

For Bicep, set this value in the resource declaration.
'Microsoft.ResourceGraph/queries'
apiVersion The resource api version

For Bicep, set this value in the resource declaration.
'2018-09-01-preview'
name The resource name string (required)
location The location of the resource string
tags Resource tags Dictionary of tag names and values. See Tags in templates
etag This will be used to handle Optimistic Concurrency. If not present, it will always overwrite the existing resource without checking conflict. string
properties Metadata describing a graph query for an Azure resource. GraphQueryProperties

GraphQueryProperties

Name Description Value
description The description of a graph query. string
query KQL query that will be graph. string (required)

Quickstart templates

The following quickstart templates deploy this resource type.

Template Description
Resource Graph Shared Query - Count OS

Deploy to Azure
This template deploys an Azure Resource Graph shared query. The shared query counts all virtual machine resources and summarizes by the OS type. A shared query can be pinned to a dashboard or converted to a supported visualization such as a bar or pie chart.