Skip to main content

graph_query

Creates, updates, deletes, gets or lists a graph_query resource.

Overview

Namegraph_query
TypeResource
Idazure.resource_graph.graph_query

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringFully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
namestringThe name of the resource.
descriptionstringThe description of a graph query.
etagstringThis will be used to handle Optimistic Concurrency. If not present, it will always overwrite the existing resource without checking conflict.
locationstringThe location of the resource.
querystringKQL query that will be graph. Required.
resultKindstringEnum indicating a type of graph query. "basic" (basic)
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
tagsobjectResource tags.
timeModifiedstring (date-time)Date and time in UTC of the last modification that was made to this graph query definition.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_group_name, resource_name, subscription_idGet a single graph query by its resourceName.
listselectresource_group_name, subscription_idGet all graph queries defined within a specified subscription and resource group.
list_by_subscriptionselectsubscription_idGet all graph queries defined within a specified subscription.
create_or_updateinsertresource_group_name, resource_name, subscription_idCreate a new graph query.
updateupdateresource_group_name, resource_name, subscription_idUpdates a graph query that has already been added.
create_or_updatereplaceresource_group_name, resource_name, subscription_idCreate a new graph query.
deletedeleteresource_group_name, resource_name, subscription_idDelete a graph query.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
resource_namestringThe name of the Graph Query resource. Required.
subscription_idstring

SELECT examples

Get a single graph query by its resourceName.

SELECT
id,
name,
description,
etag,
location,
query,
resultKind,
systemData,
tags,
timeModified,
type
FROM azure.resource_graph.graph_query
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND resource_name = '{{ resource_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;

INSERT examples

Create a new graph query.

INSERT INTO azure.resource_graph.graph_query (
properties,
tags,
location,
etag,
resource_group_name,
resource_name,
subscription_id
)
SELECT
'{{ properties }}',
'{{ tags }}',
'{{ location }}',
'{{ etag }}',
'{{ resource_group_name }}',
'{{ resource_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
etag,
location,
properties,
systemData,
tags,
type
;

UPDATE examples

Updates a graph query that has already been added.

UPDATE azure.resource_graph.graph_query
SET
tags = '{{ tags }}',
etag = '{{ etag }}',
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND resource_name = '{{ resource_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
etag,
location,
properties,
systemData,
tags,
type;

REPLACE examples

Create a new graph query.

REPLACE azure.resource_graph.graph_query
SET
properties = '{{ properties }}',
tags = '{{ tags }}',
location = '{{ location }}',
etag = '{{ etag }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND resource_name = '{{ resource_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
etag,
location,
properties,
systemData,
tags,
type;

DELETE examples

Delete a graph query.

DELETE FROM azure.resource_graph.graph_query
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND resource_name = '{{ resource_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;