graph_query
Creates, updates, deletes, gets or lists a graph_query resource.
Overview
| Name | graph_query |
| Type | Resource |
| Id | azure.resource_graph.graph_query |
Fields
The following fields are returned by SELECT queries:
- get
- list
- list_by_subscription
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
description | string | The description of a graph query. |
etag | string | This will be used to handle Optimistic Concurrency. If not present, it will always overwrite the existing resource without checking conflict. |
location | string | The location of the resource. |
query | string | KQL query that will be graph. Required. |
resultKind | string | Enum indicating a type of graph query. "basic" (basic) |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Resource tags. |
timeModified | string (date-time) | Date and time in UTC of the last modification that was made to this graph query definition. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
description | string | The description of a graph query. |
etag | string | This will be used to handle Optimistic Concurrency. If not present, it will always overwrite the existing resource without checking conflict. |
location | string | The location of the resource. |
query | string | KQL query that will be graph. Required. |
resultKind | string | Enum indicating a type of graph query. "basic" (basic) |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Resource tags. |
timeModified | string (date-time) | Date and time in UTC of the last modification that was made to this graph query definition. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
description | string | The description of a graph query. |
etag | string | This will be used to handle Optimistic Concurrency. If not present, it will always overwrite the existing resource without checking conflict. |
location | string | The location of the resource. |
query | string | KQL query that will be graph. Required. |
resultKind | string | Enum indicating a type of graph query. "basic" (basic) |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Resource tags. |
timeModified | string (date-time) | Date and time in UTC of the last modification that was made to this graph query definition. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | resource_group_name, resource_name, subscription_id | Get a single graph query by its resourceName. | |
list | select | resource_group_name, subscription_id | Get all graph queries defined within a specified subscription and resource group. | |
list_by_subscription | select | subscription_id | Get all graph queries defined within a specified subscription. | |
create_or_update | insert | resource_group_name, resource_name, subscription_id | Create a new graph query. | |
update | update | resource_group_name, resource_name, subscription_id | Updates a graph query that has already been added. | |
create_or_update | replace | resource_group_name, resource_name, subscription_id | Create a new graph query. | |
delete | delete | resource_group_name, resource_name, subscription_id | Delete 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.
| Name | Datatype | Description |
|---|---|---|
resource_group_name | string | The name of the resource group. The name is case insensitive. Required. |
resource_name | string | The name of the Graph Query resource. Required. |
subscription_id | string |
SELECT examples
- get
- list
- list_by_subscription
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
;
Get all graph queries defined within a specified subscription and resource group.
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 subscription_id = '{{ subscription_id }}' -- required
;
Get all graph queries defined within a specified subscription.
SELECT
id,
name,
description,
etag,
location,
query,
resultKind,
systemData,
tags,
timeModified,
type
FROM azure.resource_graph.graph_query
WHERE subscription_id = '{{ subscription_id }}' -- required
;
INSERT examples
- create_or_update
- Manifest
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
;
# Description fields are for documentation purposes
- name: graph_query
props:
- name: resource_group_name
value: "{{ resource_group_name }}"
description: Required parameter for the graph_query resource.
- name: resource_name
value: "{{ resource_name }}"
description: Required parameter for the graph_query resource.
- name: subscription_id
value: "{{ subscription_id }}"
description: Required parameter for the graph_query resource.
- name: properties
description: |
Metadata describing a graph query for an Azure resource.
value:
timeModified: "{{ timeModified }}"
description: "{{ description }}"
query: "{{ query }}"
resultKind: "{{ resultKind }}"
- name: tags
value: "{{ tags }}"
description: |
Resource tags.
- name: location
value: "{{ location }}"
description: |
The location of the resource.
- name: etag
value: "{{ etag }}"
description: |
This will be used to handle Optimistic Concurrency. If not present, it will always overwrite the existing resource without checking conflict.
UPDATE examples
- update
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_or_update
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
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
;