Skip to main content

queries

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

Overview

Namequeries
TypeResource
Idazure.log_analytics.queries

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.
authorstringObject Id of user creating the query.
bodystringBody of the query. Required.
descriptionstringDescription of the query.
displayNamestringUnique display name for your query within the Query Pack. Required.
propertiesobjectAdditional properties that can be set for the query.
relatedobjectThe related metadata items for the function.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
tagsobjectTags associated with the query.
timeCreatedstring (date-time)Creation Date for the Log Analytics Query, in ISO 8601 format.
timeModifiedstring (date-time)Last modified date of the Log Analytics Query, in ISO 8601 format.
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, query_pack_name, id, subscription_idGets a specific Log Analytics Query defined within a Log Analytics QueryPack.
listselectresource_group_name, query_pack_name, subscription_id$top, includeBody, $skipTokenGets a list of Queries defined within a Log Analytics QueryPack.
updateupdateresource_group_name, query_pack_name, id, subscription_idAdds or Updates a specific Query within a Log Analytics QueryPack.
deletedeleteresource_group_name, query_pack_name, id, subscription_idDeletes a specific Query defined within an Log Analytics QueryPack.
putexecresource_group_name, query_pack_name, id, subscription_idAdds or Updates a specific Query within a Log Analytics QueryPack.
searchexecresource_group_name, query_pack_name, subscription_id$top, includeBody, $skipTokenSearch a list of Queries defined within a Log Analytics QueryPack according to given search properties.

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
idstringThe id of a specific query defined in the Log Analytics QueryPack. Required.
query_pack_namestringThe name of the Log Analytics QueryPack resource. Required.
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
subscription_idstring
$skipTokenstringBase64 encoded token used to fetch the next page of items. Default is null. Default value is None.
$topintegerMaximum items returned in page. Default value is None.
includeBodybooleanFlag indicating whether or not to return the body of each applicable query. If false, only return the query information. Default value is None.

SELECT examples

Gets a specific Log Analytics Query defined within a Log Analytics QueryPack.

SELECT
id,
name,
author,
body,
description,
displayName,
properties,
related,
systemData,
tags,
timeCreated,
timeModified,
type
FROM azure.log_analytics.queries
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND query_pack_name = '{{ query_pack_name }}' -- required
AND id = '{{ id }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;

UPDATE examples

Adds or Updates a specific Query within a Log Analytics QueryPack.

UPDATE azure.log_analytics.queries
SET
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND query_pack_name = '{{ query_pack_name }}' --required
AND id = '{{ id }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
properties,
systemData,
type;

DELETE examples

Deletes a specific Query defined within an Log Analytics QueryPack.

DELETE FROM azure.log_analytics.queries
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND query_pack_name = '{{ query_pack_name }}' --required
AND id = '{{ id }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;

Lifecycle Methods

Adds or Updates a specific Query within a Log Analytics QueryPack.

EXEC azure.log_analytics.queries.put 
@resource_group_name='{{ resource_group_name }}' --required,
@query_pack_name='{{ query_pack_name }}' --required,
@id='{{ id }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"properties": "{{ properties }}"
}'
;