Graph Query - Get

Get a single graph query by its resourceName.

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceGraph/queries/{resourceName}?api-version=2024-04-01

URI Parameters

Name In Required Type Description
resourceGroupName
path True

string

The name of the resource group. The name is case insensitive.

resourceName
path True

string

The name of the Graph Query resource.

Regex pattern: ^[^<>&:\?]*$

subscriptionId
path True

string

uuid

The ID of the target subscription. The value must be an UUID.

api-version
query True

string

The API version to use for this operation.

Responses

Name Type Description
200 OK

GraphQueryResource

A graph query definition.

Other Status Codes

GraphQueryError

Error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Get Graph Query

Sample request

GET https://management.azure.com/subscriptions/024e2271-06fa-46b6-9079-f1ed3c7b070e/resourceGroups/my-resource-group/providers/Microsoft.ResourceGraph/queries/MyDockerVMs?api-version=2024-04-01

Sample response

{
  "id": " /subscriptions/024e2271-06fa-46b6-9079-f1ed3c7b070e/resources/my-resource-group/providers/Microsoft.ResourceGraph/queries/MyDockerVMs",
  "name": "MyDockerVMs",
  "type": "Microsoft.ResourceGraph/queries",
  "etag": "5d64408e-4ca3-41f7-b725-6914f3012afa",
  "tags": null,
  "properties": {
    "description": "Docker VMs in PROD",
    "query": "where isnotnull(tags['Prod']) and properties.extensions[0].Name == 'docker'",
    "resultKind": "basic",
    "timeModified": "2019-03-12T13:51:13-07:00"
  }
}

Definitions

Name Description
createdByType

The type of identity that created the resource.

Error

The error object.

ErrorFieldContract

Error Field contract.

GraphQueryError

Error message body that will indicate why the operation failed.

GraphQueryResource

Graph Query entity definition.

ResultKind

Enum indicating a type of graph query.

systemData

Metadata pertaining to creation and last modification of the resource.

createdByType

The type of identity that created the resource.

Name Type Description
Application

string

Key

string

ManagedIdentity

string

User

string

Error

The error object.

Name Type Description
code

string

Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.

details

ErrorFieldContract[]

The list of invalid fields send in request, in case of validation error.

message

string

Human-readable representation of the error.

ErrorFieldContract

Error Field contract.

Name Type Description
code

string

Property level error code.

message

string

Human-readable representation of property-level error.

target

string

Property name.

GraphQueryError

Error message body that will indicate why the operation failed.

Name Type Description
error

Error

The error object.

GraphQueryResource

Graph Query entity definition.

Name Type Description
etag

string

This will be used to handle Optimistic Concurrency. If not present, it will always overwrite the existing resource without checking conflict.

id

string

Azure resource Id

location

string

The location of the resource

name

string

Azure resource name. This is GUID value. The display name should be assigned within properties field.

properties.description

string

The description of a graph query.

properties.query

string

KQL query that will be graph.

properties.resultKind

ResultKind

Enum indicating a type of graph query.

properties.timeModified

string

Date and time in UTC of the last modification that was made to this graph query definition.

systemData

systemData

The system metadata relating to this resource.

tags

object

Resource tags

type

string

Azure resource type

ResultKind

Enum indicating a type of graph query.

Name Type Description
basic

string

systemData

Metadata pertaining to creation and last modification of the resource.

Name Type Description
createdAt

string

The timestamp of resource creation (UTC).

createdBy

string

The identity that created the resource.

createdByType

createdByType

The type of identity that created the resource.

lastModifiedAt

string

The timestamp of resource last modification (UTC)

lastModifiedBy

string

The identity that last modified the resource.

lastModifiedByType

createdByType

The type of identity that last modified the resource.