1. Packages
  2. Azure Native v1
  3. API Docs
  4. operationalinsights
  5. Query
These are the docs for Azure Native v1. We recommenend using the latest version, Azure Native v2.
Azure Native v1 v1.104.0 published on Thursday, Jul 6, 2023 by Pulumi

azure-native.operationalinsights.Query

Explore with Pulumi AI

azure-native-v1 logo
These are the docs for Azure Native v1. We recommenend using the latest version, Azure Native v2.
Azure Native v1 v1.104.0 published on Thursday, Jul 6, 2023 by Pulumi

    A Log Analytics QueryPack-Query definition. API Version: 2019-09-01.

    Example Usage

    QueryPut

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AzureNative = Pulumi.AzureNative;
    
    return await Deployment.RunAsync(() => 
    {
        var query = new AzureNative.OperationalInsights.Query("query", new()
        {
            Body = @"let newExceptionsTimeRange = 1d;
    let timeRangeToCheckBefore = 7d;
    exceptions
    | where timestamp < ago(timeRangeToCheckBefore)
    | summarize count() by problemId
    | join kind= rightanti (
    exceptions
    | where timestamp >= ago(newExceptionsTimeRange)
    | extend stack = tostring(details[0].rawStack)
    | summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId  
    ) on problemId 
    | order by  count_ desc
    ",
            Description = "my description",
            DisplayName = "Exceptions - New in the last 24 hours",
            Id = "a449f8af-8e64-4b3a-9b16-5a7165ff98c4",
            QueryPackName = "my-querypack",
            Related = new AzureNative.OperationalInsights.Inputs.LogAnalyticsQueryPackQueryPropertiesRelatedArgs
            {
                Categories = new[]
                {
                    "analytics",
                },
            },
            ResourceGroupName = "my-resource-group",
            Tags = 
            {
                { "my-label", new[]
                {
                    "label1",
                } },
                { "my-other-label", new[]
                {
                    "label2",
                } },
            },
        });
    
    });
    
    package main
    
    import (
    	operationalinsights "github.com/pulumi/pulumi-azure-native-sdk/operationalinsights"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := operationalinsights.NewQuery(ctx, "query", &operationalinsights.QueryArgs{
    			Body:          pulumi.String("let newExceptionsTimeRange = 1d;\nlet timeRangeToCheckBefore = 7d;\nexceptions\n| where timestamp < ago(timeRangeToCheckBefore)\n| summarize count() by problemId\n| join kind= rightanti (\nexceptions\n| where timestamp >= ago(newExceptionsTimeRange)\n| extend stack = tostring(details[0].rawStack)\n| summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId  \n) on problemId \n| order by  count_ desc\n"),
    			Description:   pulumi.String("my description"),
    			DisplayName:   pulumi.String("Exceptions - New in the last 24 hours"),
    			Id:            pulumi.String("a449f8af-8e64-4b3a-9b16-5a7165ff98c4"),
    			QueryPackName: pulumi.String("my-querypack"),
    			Related: &operationalinsights.LogAnalyticsQueryPackQueryPropertiesRelatedArgs{
    				Categories: pulumi.StringArray{
    					pulumi.String("analytics"),
    				},
    			},
    			ResourceGroupName: pulumi.String("my-resource-group"),
    			Tags: pulumi.StringArrayMap{
    				"my-label": pulumi.StringArray{
    					pulumi.String("label1"),
    				},
    				"my-other-label": pulumi.StringArray{
    					pulumi.String("label2"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azurenative.operationalinsights.Query;
    import com.pulumi.azurenative.operationalinsights.QueryArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var query = new Query("query", QueryArgs.builder()        
                .body("""
    let newExceptionsTimeRange = 1d;
    let timeRangeToCheckBefore = 7d;
    exceptions
    | where timestamp < ago(timeRangeToCheckBefore)
    | summarize count() by problemId
    | join kind= rightanti (
    exceptions
    | where timestamp >= ago(newExceptionsTimeRange)
    | extend stack = tostring(details[0].rawStack)
    | summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId  
    ) on problemId 
    | order by  count_ desc
                """)
                .description("my description")
                .displayName("Exceptions - New in the last 24 hours")
                .id("a449f8af-8e64-4b3a-9b16-5a7165ff98c4")
                .queryPackName("my-querypack")
                .related(Map.of("categories", "analytics"))
                .resourceGroupName("my-resource-group")
                .tags(Map.ofEntries(
                    Map.entry("my-label", "label1"),
                    Map.entry("my-other-label", "label2")
                ))
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_azure_native as azure_native
    
    query = azure_native.operationalinsights.Query("query",
        body="""let newExceptionsTimeRange = 1d;
    let timeRangeToCheckBefore = 7d;
    exceptions
    | where timestamp < ago(timeRangeToCheckBefore)
    | summarize count() by problemId
    | join kind= rightanti (
    exceptions
    | where timestamp >= ago(newExceptionsTimeRange)
    | extend stack = tostring(details[0].rawStack)
    | summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId  
    ) on problemId 
    | order by  count_ desc
    """,
        description="my description",
        display_name="Exceptions - New in the last 24 hours",
        id="a449f8af-8e64-4b3a-9b16-5a7165ff98c4",
        query_pack_name="my-querypack",
        related=azure_native.operationalinsights.LogAnalyticsQueryPackQueryPropertiesRelatedArgs(
            categories=["analytics"],
        ),
        resource_group_name="my-resource-group",
        tags={
            "my-label": ["label1"],
            "my-other-label": ["label2"],
        })
    
    import * as pulumi from "@pulumi/pulumi";
    import * as azure_native from "@pulumi/azure-native";
    
    const query = new azure_native.operationalinsights.Query("query", {
        body: `let newExceptionsTimeRange = 1d;
    let timeRangeToCheckBefore = 7d;
    exceptions
    | where timestamp < ago(timeRangeToCheckBefore)
    | summarize count() by problemId
    | join kind= rightanti (
    exceptions
    | where timestamp >= ago(newExceptionsTimeRange)
    | extend stack = tostring(details[0].rawStack)
    | summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId  
    ) on problemId 
    | order by  count_ desc
    `,
        description: "my description",
        displayName: "Exceptions - New in the last 24 hours",
        id: "a449f8af-8e64-4b3a-9b16-5a7165ff98c4",
        queryPackName: "my-querypack",
        related: {
            categories: ["analytics"],
        },
        resourceGroupName: "my-resource-group",
        tags: {
            "my-label": ["label1"],
            "my-other-label": ["label2"],
        },
    });
    
    resources:
      query:
        type: azure-native:operationalinsights:Query
        properties:
          body: "let newExceptionsTimeRange = 1d;\nlet timeRangeToCheckBefore = 7d;\nexceptions\n| where timestamp < ago(timeRangeToCheckBefore)\n| summarize count() by problemId\n| join kind= rightanti (\nexceptions\n| where timestamp >= ago(newExceptionsTimeRange)\n| extend stack = tostring(details[0].rawStack)\n| summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId  \n) on problemId \n| order by  count_ desc\n"
          description: my description
          displayName: Exceptions - New in the last 24 hours
          id: a449f8af-8e64-4b3a-9b16-5a7165ff98c4
          queryPackName: my-querypack
          related:
            categories:
              - analytics
          resourceGroupName: my-resource-group
          tags:
            my-label:
              - label1
            my-other-label:
              - label2
    

    Create Query Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Query(name: string, args: QueryArgs, opts?: CustomResourceOptions);
    @overload
    def Query(resource_name: str,
              args: QueryArgs,
              opts: Optional[ResourceOptions] = None)
    
    @overload
    def Query(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              body: Optional[str] = None,
              display_name: Optional[str] = None,
              query_pack_name: Optional[str] = None,
              resource_group_name: Optional[str] = None,
              description: Optional[str] = None,
              id: Optional[str] = None,
              properties: Optional[Any] = None,
              related: Optional[LogAnalyticsQueryPackQueryPropertiesRelatedArgs] = None,
              tags: Optional[Mapping[str, Sequence[str]]] = None)
    func NewQuery(ctx *Context, name string, args QueryArgs, opts ...ResourceOption) (*Query, error)
    public Query(string name, QueryArgs args, CustomResourceOptions? opts = null)
    public Query(String name, QueryArgs args)
    public Query(String name, QueryArgs args, CustomResourceOptions options)
    
    type: azure-native:operationalinsights:Query
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args QueryArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args QueryArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args QueryArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args QueryArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args QueryArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var queryResource = new AzureNative.Operationalinsights.Query("queryResource", new()
    {
        Body = "string",
        DisplayName = "string",
        QueryPackName = "string",
        ResourceGroupName = "string",
        Description = "string",
        Id = "string",
        Properties = "any",
        Related = 
        {
            { "categories", new[]
            {
                "string",
            } },
            { "resourceTypes", new[]
            {
                "string",
            } },
            { "solutions", new[]
            {
                "string",
            } },
        },
        Tags = 
        {
            { "string", new[]
            {
                "string",
            } },
        },
    });
    
    example, err := operationalinsights.NewQuery(ctx, "queryResource", &operationalinsights.QueryArgs{
    	Body:              "string",
    	DisplayName:       "string",
    	QueryPackName:     "string",
    	ResourceGroupName: "string",
    	Description:       "string",
    	Id:                "string",
    	Properties:        "any",
    	Related: map[string]interface{}{
    		"categories": []string{
    			"string",
    		},
    		"resourceTypes": []string{
    			"string",
    		},
    		"solutions": []string{
    			"string",
    		},
    	},
    	Tags: map[string]interface{}{
    		"string": []string{
    			"string",
    		},
    	},
    })
    
    var queryResource = new Query("queryResource", QueryArgs.builder()
        .body("string")
        .displayName("string")
        .queryPackName("string")
        .resourceGroupName("string")
        .description("string")
        .id("string")
        .properties("any")
        .related(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
        .tags(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
        .build());
    
    query_resource = azure_native.operationalinsights.Query("queryResource",
        body=string,
        display_name=string,
        query_pack_name=string,
        resource_group_name=string,
        description=string,
        id=string,
        properties=any,
        related={
            categories: [string],
            resourceTypes: [string],
            solutions: [string],
        },
        tags={
            string: [string],
        })
    
    const queryResource = new azure_native.operationalinsights.Query("queryResource", {
        body: "string",
        displayName: "string",
        queryPackName: "string",
        resourceGroupName: "string",
        description: "string",
        id: "string",
        properties: "any",
        related: {
            categories: ["string"],
            resourceTypes: ["string"],
            solutions: ["string"],
        },
        tags: {
            string: ["string"],
        },
    });
    
    type: azure-native:operationalinsights:Query
    properties:
        body: string
        description: string
        displayName: string
        id: string
        properties: any
        queryPackName: string
        related:
            categories:
                - string
            resourceTypes:
                - string
            solutions:
                - string
        resourceGroupName: string
        tags:
            string:
                - string
    

    Query Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Query resource accepts the following input properties:

    Body string
    Body of the query.
    DisplayName string
    Unique display name for your query within the Query Pack.
    QueryPackName string
    The name of the Log Analytics QueryPack resource.
    ResourceGroupName string
    The name of the resource group. The name is case insensitive.
    Description string
    Description of the query.
    Id string
    The id of a specific query defined in the Log Analytics QueryPack
    Properties object
    Additional properties that can be set for the query.
    Related Pulumi.AzureNative.OperationalInsights.Inputs.LogAnalyticsQueryPackQueryPropertiesRelated
    The related metadata items for the function.
    Tags Dictionary<string, ImmutableArray<string>>
    Tags associated with the query.
    Body string
    Body of the query.
    DisplayName string
    Unique display name for your query within the Query Pack.
    QueryPackName string
    The name of the Log Analytics QueryPack resource.
    ResourceGroupName string
    The name of the resource group. The name is case insensitive.
    Description string
    Description of the query.
    Id string
    The id of a specific query defined in the Log Analytics QueryPack
    Properties interface{}
    Additional properties that can be set for the query.
    Related LogAnalyticsQueryPackQueryPropertiesRelatedArgs
    The related metadata items for the function.
    Tags map[string][]string
    Tags associated with the query.
    body String
    Body of the query.
    displayName String
    Unique display name for your query within the Query Pack.
    queryPackName String
    The name of the Log Analytics QueryPack resource.
    resourceGroupName String
    The name of the resource group. The name is case insensitive.
    description String
    Description of the query.
    id String
    The id of a specific query defined in the Log Analytics QueryPack
    properties Object
    Additional properties that can be set for the query.
    related LogAnalyticsQueryPackQueryPropertiesRelated
    The related metadata items for the function.
    tags Map<String,List<String>>
    Tags associated with the query.
    body string
    Body of the query.
    displayName string
    Unique display name for your query within the Query Pack.
    queryPackName string
    The name of the Log Analytics QueryPack resource.
    resourceGroupName string
    The name of the resource group. The name is case insensitive.
    description string
    Description of the query.
    id string
    The id of a specific query defined in the Log Analytics QueryPack
    properties any
    Additional properties that can be set for the query.
    related LogAnalyticsQueryPackQueryPropertiesRelated
    The related metadata items for the function.
    tags {[key: string]: string[]}
    Tags associated with the query.
    body str
    Body of the query.
    display_name str
    Unique display name for your query within the Query Pack.
    query_pack_name str
    The name of the Log Analytics QueryPack resource.
    resource_group_name str
    The name of the resource group. The name is case insensitive.
    description str
    Description of the query.
    id str
    The id of a specific query defined in the Log Analytics QueryPack
    properties Any
    Additional properties that can be set for the query.
    related LogAnalyticsQueryPackQueryPropertiesRelatedArgs
    The related metadata items for the function.
    tags Mapping[str, Sequence[str]]
    Tags associated with the query.
    body String
    Body of the query.
    displayName String
    Unique display name for your query within the Query Pack.
    queryPackName String
    The name of the Log Analytics QueryPack resource.
    resourceGroupName String
    The name of the resource group. The name is case insensitive.
    description String
    Description of the query.
    id String
    The id of a specific query defined in the Log Analytics QueryPack
    properties Any
    Additional properties that can be set for the query.
    related Property Map
    The related metadata items for the function.
    tags Map<List<String>>
    Tags associated with the query.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Query resource produces the following output properties:

    Author string
    Object Id of user creating the query.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Azure resource name
    SystemData Pulumi.AzureNative.OperationalInsights.Outputs.SystemDataResponse
    Read only system data
    TimeCreated string
    Creation Date for the Log Analytics Query, in ISO 8601 format.
    TimeModified string
    Last modified date of the Log Analytics Query, in ISO 8601 format.
    Type string
    Azure resource type
    Author string
    Object Id of user creating the query.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Azure resource name
    SystemData SystemDataResponse
    Read only system data
    TimeCreated string
    Creation Date for the Log Analytics Query, in ISO 8601 format.
    TimeModified string
    Last modified date of the Log Analytics Query, in ISO 8601 format.
    Type string
    Azure resource type
    author String
    Object Id of user creating the query.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    Azure resource name
    systemData SystemDataResponse
    Read only system data
    timeCreated String
    Creation Date for the Log Analytics Query, in ISO 8601 format.
    timeModified String
    Last modified date of the Log Analytics Query, in ISO 8601 format.
    type String
    Azure resource type
    author string
    Object Id of user creating the query.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    Azure resource name
    systemData SystemDataResponse
    Read only system data
    timeCreated string
    Creation Date for the Log Analytics Query, in ISO 8601 format.
    timeModified string
    Last modified date of the Log Analytics Query, in ISO 8601 format.
    type string
    Azure resource type
    author str
    Object Id of user creating the query.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    Azure resource name
    system_data SystemDataResponse
    Read only system data
    time_created str
    Creation Date for the Log Analytics Query, in ISO 8601 format.
    time_modified str
    Last modified date of the Log Analytics Query, in ISO 8601 format.
    type str
    Azure resource type
    author String
    Object Id of user creating the query.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    Azure resource name
    systemData Property Map
    Read only system data
    timeCreated String
    Creation Date for the Log Analytics Query, in ISO 8601 format.
    timeModified String
    Last modified date of the Log Analytics Query, in ISO 8601 format.
    type String
    Azure resource type

    Supporting Types

    LogAnalyticsQueryPackQueryPropertiesRelated, LogAnalyticsQueryPackQueryPropertiesRelatedArgs

    Categories List<string>
    The related categories for the function.
    ResourceTypes List<string>
    The related resource types for the function.
    Solutions List<string>
    The related Log Analytics solutions for the function.
    Categories []string
    The related categories for the function.
    ResourceTypes []string
    The related resource types for the function.
    Solutions []string
    The related Log Analytics solutions for the function.
    categories List<String>
    The related categories for the function.
    resourceTypes List<String>
    The related resource types for the function.
    solutions List<String>
    The related Log Analytics solutions for the function.
    categories string[]
    The related categories for the function.
    resourceTypes string[]
    The related resource types for the function.
    solutions string[]
    The related Log Analytics solutions for the function.
    categories Sequence[str]
    The related categories for the function.
    resource_types Sequence[str]
    The related resource types for the function.
    solutions Sequence[str]
    The related Log Analytics solutions for the function.
    categories List<String>
    The related categories for the function.
    resourceTypes List<String>
    The related resource types for the function.
    solutions List<String>
    The related Log Analytics solutions for the function.

    LogAnalyticsQueryPackQueryPropertiesResponseRelated, LogAnalyticsQueryPackQueryPropertiesResponseRelatedArgs

    Categories List<string>
    The related categories for the function.
    ResourceTypes List<string>
    The related resource types for the function.
    Solutions List<string>
    The related Log Analytics solutions for the function.
    Categories []string
    The related categories for the function.
    ResourceTypes []string
    The related resource types for the function.
    Solutions []string
    The related Log Analytics solutions for the function.
    categories List<String>
    The related categories for the function.
    resourceTypes List<String>
    The related resource types for the function.
    solutions List<String>
    The related Log Analytics solutions for the function.
    categories string[]
    The related categories for the function.
    resourceTypes string[]
    The related resource types for the function.
    solutions string[]
    The related Log Analytics solutions for the function.
    categories Sequence[str]
    The related categories for the function.
    resource_types Sequence[str]
    The related resource types for the function.
    solutions Sequence[str]
    The related Log Analytics solutions for the function.
    categories List<String>
    The related categories for the function.
    resourceTypes List<String>
    The related resource types for the function.
    solutions List<String>
    The related Log Analytics solutions for the function.

    SystemDataResponse, SystemDataResponseArgs

    CreatedAt string
    The timestamp of resource creation (UTC).
    CreatedBy string
    The identity that created the resource.
    CreatedByType string
    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 string
    The type of identity that last modified the resource.
    CreatedAt string
    The timestamp of resource creation (UTC).
    CreatedBy string
    The identity that created the resource.
    CreatedByType string
    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 string
    The type of identity that last modified the resource.
    createdAt String
    The timestamp of resource creation (UTC).
    createdBy String
    The identity that created the resource.
    createdByType String
    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 String
    The type of identity that last modified the resource.
    createdAt string
    The timestamp of resource creation (UTC).
    createdBy string
    The identity that created the resource.
    createdByType string
    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 string
    The type of identity that last modified the resource.
    created_at str
    The timestamp of resource creation (UTC).
    created_by str
    The identity that created the resource.
    created_by_type str
    The type of identity that created the resource.
    last_modified_at str
    The timestamp of resource last modification (UTC)
    last_modified_by str
    The identity that last modified the resource.
    last_modified_by_type str
    The type of identity that last modified the resource.
    createdAt String
    The timestamp of resource creation (UTC).
    createdBy String
    The identity that created the resource.
    createdByType String
    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 String
    The type of identity that last modified the resource.

    Import

    An existing resource can be imported using its type token, name, and identifier, e.g.

    $ pulumi import azure-native:operationalinsights:Query a449f8af-8e64-4b3a-9b16-5a7165ff98c4 /subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4918/resourceGroups/my-resource-group/providers/microsoft.operationalinsights/queryPacks/my-querypack/queries/a449f8af-8e64-4b3a-9b16-5a7165ff98c4 
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    azure-native-v1 pulumi/pulumi-azure-native
    License
    Apache-2.0
    azure-native-v1 logo
    These are the docs for Azure Native v1. We recommenend using the latest version, Azure Native v2.
    Azure Native v1 v1.104.0 published on Thursday, Jul 6, 2023 by Pulumi