Azure Resource Graph Query
Azure Resource Graph Query API Reference
COMMUNITYBEARER0 INSTALLS
OpenAPI Specificationv3.0
{
"swagger": "2.0",
"schemes": [
"https"
],
"host": "management.azure.com",
"info": {
"description": "Azure Resource Graph Query API Reference",
"title": "Azure Resource Graph Query",
"version": "2018-09-01-preview",
"x-apisguru-categories": [
"cloud"
],
"x-logo": {
"url": "https://api.apis.guru/v2/cache/logo/https_assets.onestore.ms_cdnfiles_onestorerolling-1606-01000_shell_v3_images_logo_microsoft.png"
},
"x-origin": [
{
"format": "swagger",
"url": "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2018-09-01-preview/graphquery.json",
"version": "2.0"
}
],
"x-providerName": "azure.com",
"x-serviceName": "resourcegraph-graphquery",
"x-tags": [
"Azure",
"Microsoft"
]
},
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"securityDefinitions": {
"azure_auth": {
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
"description": "Azure Active Directory OAuth2 Flow.",
"flow": "implicit",
"scopes": {
"user_impersonation": "impersonate your user account"
},
"type": "oauth2"
}
},
"security": [
{
"azure_auth": [
"user_impersonation"
]
}
],
"parameters": {
"ApiVersionParameter": {
"description": "Client Api Version.",
"in": "query",
"name": "api-version",
"required": true,
"type": "string"
},
"GraphQueryResourceNameParameter": {
"description": "The name of the Graph Query resource.",
"in": "path",
"name": "resourceName",
"required": true,
"type": "string",
"x-ms-parameter-location": "method"
},
"ResourceGroupNameParameter": {
"description": "The name of the resource group.",
"in": "path",
"name": "resourceGroupName",
"required": true,
"type": "string",
"x-ms-parameter-location": "method"
},
"SubscriptionIdParameter": {
"description": "The Azure subscription Id.",
"in": "path",
"name": "subscriptionId",
"required": true,
"type": "string"
}
},
"paths": {
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceGraph/queries": {
"get": {
"description": "Get all graph queries defined within a specified subscription and resource group.",
"operationId": "GraphQuery_List",
"parameters": [
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "A list containing 0 or more graph queries.",
"schema": {
"$ref": "#/definitions/GraphQueryListResult"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/GraphQueryError"
}
}
},
"x-ms-examples": {
"Get a list of Graph Queries": {
"description": "Get a list of saved queries within subscription id and resource group.",
"parameters": {
"api-version": "2018-09-01-preview",
"resourceGroupName": "my-resource-group",
"subscriptionId": "024e2271-06fa-46b6-9079-f1ed3c7b070e"
},
"responses": {
"200": {
"body": {
"nextLink": "https://management.azure.com/subscriptions/subscriptionId/providers/Microsoft.ResourceGraph/queries?api-version=2019-09-01-preview&$top=10&$skiptoken=skiptoken",
"value": [
{
"eTag": "5d64408e-4ca3-41f7-b725-6914f3012afa",
"id": "/subscriptions/87f4f8b0-83c1-4aa9-b318-5237aeb15264/resources/rid1/providers/Microsoft.ResourceGraph/queries/MyDockerVMs",
"name": "MyDockerVMs",
"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"
},
"tags": {},
"type": "Microsoft.ResourceGraph/queries"
},
{
"eTag": "b0809832-ca62-4133-8f13-0c46580f9db1",
"id": "/subscriptions/6abb2f31-3e6a-4134-9968-219a596012a0/resources/rid2/providers/Microsoft.ResourceGraph/queries/MyTestVMs",
"name": "MyTestVMs",
"properties": {
"description": "Test VMs in PROD",
"query": "where isnotnull(tags['Prod']) and properties.extensions[0].Name == 'test'",
"resultKind": "basic",
"timeModified": "2019-03-13T13:51:13-07:00"
},
"tags": {},
"type": "Microsoft.ResourceGraph/queries"
}
]
}
}
},
"title": "Get a list of saved queries"
}
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceGraph/queries/{resourceName}": {
"delete": {
"description": "Delete a graph query.",
"operationId": "GraphQuery_Delete",
"parameters": [
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "#/parameters/GraphQueryResourceNameParameter"
},
{
"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "The graph query has been successfully deleted."
},
"204": {
"description": "The resource doesn't exist."
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/GraphQueryError"
}
}
},
"x-ms-examples": {
"Delete Graph Query": {
"description": "Delete a saved query resource by subid, resource group, and resource name.",
"parameters": {
"api-version": "2018-09-01-preview",
"resourceGroupName": "my-resource-group",
"resourceName": "MyDockerVM",
"subscriptionId": "024e2271-06fa-46b6-9079-f1ed3c7b070e"
},
"responses": {
"200": {},
"204": {}
},
"title": "Delete a saved query"
}
}
},
"get": {
"description": "Get a single graph query by its resourceName.",
"operationId": "GraphQuery_Get",
"parameters": [
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "#/parameters/GraphQueryResourceNameParameter"
},
{
"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "A graph query definition.",
"schema": {
"$ref": "#/definitions/GraphQueryResource"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/GraphQueryError"
}
}
},
"x-ms-examples": {
"Get Graph Query": {
"description": "Get a saved query resource by subid, resource group, and resource name.",
"parameters": {
"api-version": "2018-09-01-preview",
"resourceGroupName": "my-resource-group",
"resourceName": "MyDockerVMs",
"subscriptionId": "024e2271-06fa-46b6-9079-f1ed3c7b070e"
},
"responses": {
"200": {
"body": {
"eTag": "5d64408e-4ca3-41f7-b725-6914f3012afa",
"id": " /subscriptions/024e2271-06fa-46b6-9079-f1ed3c7b070e/resources/my-resource-group/providers/Microsoft.ResourceGraph/queries/MyDockerVMs",
"name": "MyDockerVMs",
"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"
},
"tags": null,
"type": "Microsoft.ResourceGraph/queries"
}
}
},
"title": "Get a saved query"
}
}
},
"patch": {
"description": "Updates a graph query that has already been added.",
"operationId": "GraphQuery_Update",
"parameters": [
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "#/parameters/GraphQueryResourceNameParameter"
},
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"description": "Properties that need to be specified to create a new graph query.",
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/GraphQueryUpdateParameters"
}
}
],
"responses": {
"200": {
"description": "The graph query definition updated.",
"schema": {
"$ref": "#/definitions/GraphQueryResource"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/GraphQueryError"
}
}
},
"x-ms-examples": {
"Update Graph Query": {
"description": "Update the existing saved query resource.",
"parameters": {
"api-version": "2018-09-01-preview",
"body": {
"eTag": "b0809832-ca62-4133-8f13-0c46580f9db1",
"properties": {
"description": "Modified description",
"query": "where isnotnull(tags['Prod']) and properties.extensions[0].Name == 'docker'"
},
"tags": null
},
"resourceGroupName": "my-resource-group",
"resourceName": "MyDockerVMs",
"subscriptionId": "024e2271-06fa-46b6-9079-f1ed3c7b070e"
},
"responses": {
"200": {
"body": {
"eTag": "73811091-6188-4523-97b7-b5e7134e7fd9",
"id": " /subscriptions/024e2271-06fa-46b6-9079-f1ed3c7b070e/resources/my-resource-group/providers/Microsoft.ResourceGraph/queries/MyDockerVMs",
"name": "MyDockerVMs",
"properties": {
"description": "Modified description",
"query": "where isnotnull(tags['Prod']) and properties.extensions[0].Name == 'docker'",
"resultKind": "basic",
"timeModified": "2019-03-14T13:51:13-07:00"
},
"tags": null,
"type": "Microsoft.ResourceGraph/queries"
}
}
},
"title": "Update a saved query"
}
}
},
"put": {
"description": "Create a new graph query.",
"operationId": "GraphQuery_CreateOrUpdate",
"parameters": [
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "#/parameters/GraphQueryResourceNameParameter"
},
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"description": "Properties that need to be specified to create a new graph query.",
"in": "body",
"name": "properties",
"required": true,
"schema": {
"$ref": "#/definitions/GraphQueryResource"
}
}
],
"responses": {
"200": {
"description": "The newly created graph query.",
"schema": {
"$ref": "#/definitions/GraphQueryResource"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/GraphQueryError"
}
}
},
"x-ms-examples": {
"Create Graph Query": {
"description": "Create new saved query resource.",
"parameters": {
"api-version": "2018-09-01-preview",
"properties": {
"properties": {
"description": "Docker VMs in PROD",
"query": "where isnotnull(tags['Prod']) and properties.extensions[0].Name == 'docker'"
},
"tags": {}
},
"resourceGroupName": "my-resource-group",
"resourceName": "MyDockerVMs",
"subscriptionId": "024e2271-06fa-46b6-9079-f1ed3c7b070e"
},
"responses": {
"200": {
"body": {
"eTag": "5d64408e-4ca3-41f7-b725-6914f3012afa",
"id": " /subscriptions/024e2271-06fa-46b6-9079-f1ed3c7b070e/resources/my-resource-group/providers/Microsoft.ResourceGraph/queries/MyDockerVMs",
"name": "MyDockerVMs",
"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"
},
"tags": {},
"type": "Microsoft.ResourceGraph/queries"
}
}
},
"title": "Create a saved query"
}
}
}
}
},
"definitions": {
"ErrorFieldContract": {
"description": "Error Field contract.",
"properties": {
"code": {
"description": "Property level error code.",
"type": "string"
},
"message": {
"description": "Human-readable representation of property-level error.",
"type": "string"
},
"target": {
"description": "Property name.",
"type": "string"
}
}
},
"GraphQueryError": {
"description": "Error message body that will indicate why the operation failed.",
"properties": {
"code": {
"description": "Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.",
"type": "string"
},
"details": {
"description": "The list of invalid fields send in request, in case of validation error.",
"items": {
"$ref": "#/definitions/ErrorFieldContract"
},
"type": "array"
},
"message": {
"description": "Human-readable representation of the error.",
"type": "string"
}
}
},
"GraphQueryListResult": {
"description": "Graph query list result.",
"properties": {
"nextLink": {
"description": "URL to fetch the next set of queries.",
"type": "string"
},
"value": {
"description": "An array of graph queries.",
"items": {
"$ref": "#/definitions/GraphQueryResource"
},
"readOnly": true,
"type": "array"
}
}
},
"GraphQueryProperties": {
"description": "Properties that contain a graph query.",
"properties": {
"description": {
"description": "The description of a graph query.",
"type": "string"
},
"query": {
"description": "KQL query that will be graph.",
"type": "string"
},
"resultKind": {
"description": "Enum indicating a type of graph query.",
"enum": [
"basic"
],
"readOnly": true,
"type": "string",
"x-ms-enum": {
"modelAsString": true,
"name": "ResultKind"
}
},
"timeModified": {
"description": "Date and time in UTC of the last modification that was made to this graph query definition.",
"format": "date-time",
"readOnly": true,
"type": "string"
}
},
"required": [
"query"
]
},
"GraphQueryPropertiesUpdateParameters": {
"description": "Properties that contain a workbook for PATCH operation.",
"properties": {
"description": {
"description": "The description of a graph query.",
"type": "string"
},
"query": {
"description": "KQL query that will be graph.",
"type": "string"
}
}
},
"GraphQueryResource": {
"allOf": [
{
"$ref": "#/definitions/Resource"
}
],
"description": "Graph Query entity definition.",
"properties": {
"properties": {
"$ref": "#/definitions/GraphQueryProperties",
"description": "Metadata describing a graph query for an Azure resource.",
"x-ms-client-flatten": true
}
}
},
"GraphQueryUpdateParameters": {
"description": "The parameters that can be provided when updating workbook properties properties.",
"properties": {
"eTag": {
"description": "This will be used to handle Optimistic Concurrency. If not present, it will always overwrite the existing resource without checking conflict.",
"type": "string"
},
"properties": {
"$ref": "#/definitions/GraphQueryPropertiesUpdateParameters",
"description": "Metadata describing a graph query for an Azure resource.",
"x-ms-client-flatten": true
},
"tags": {
"additionalProperties": {
"type": "string"
},
"description": "Resource tags",
"type": "object"
}
}
},
"Resource": {
"description": "An azure resource object",
"properties": {
"eTag": {
"description": "This will be used to handle Optimistic Concurrency. If not present, it will always overwrite the existing resource without checking conflict.",
"type": "string"
},
"id": {
"description": "Azure resource Id",
"readOnly": true,
"type": "string"
},
"name": {
"description": "Azure resource name. This is GUID value. The display name should be assigned within properties field.",
"readOnly": true,
"type": "string"
},
"tags": {
"additionalProperties": {
"type": "string"
},
"description": "Resource tags",
"type": "object"
},
"type": {
"description": "Azure resource type",
"readOnly": true,
"type": "string"
}
},
"x-ms-azure-resource": true
}
}
}