1. Packages
  2. Azure Classic
  3. API Docs
  4. appinsights
  5. AnalyticsItem

We recommend using Azure Native.

Azure Classic v5.66.1 published on Wednesday, Feb 14, 2024 by Pulumi

azure.appinsights.AnalyticsItem

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.66.1 published on Wednesday, Feb 14, 2024 by Pulumi

    Manages an Application Insights Analytics Item component.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new()
        {
            Location = "West Europe",
        });
    
        var exampleInsights = new Azure.AppInsights.Insights("exampleInsights", new()
        {
            Location = exampleResourceGroup.Location,
            ResourceGroupName = exampleResourceGroup.Name,
            ApplicationType = "web",
        });
    
        var exampleAnalyticsItem = new Azure.AppInsights.AnalyticsItem("exampleAnalyticsItem", new()
        {
            ApplicationInsightsId = exampleInsights.Id,
            Content = "requests //simple example query",
            Scope = "shared",
            Type = "query",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/appinsights"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleInsights, err := appinsights.NewInsights(ctx, "exampleInsights", &appinsights.InsightsArgs{
    			Location:          exampleResourceGroup.Location,
    			ResourceGroupName: exampleResourceGroup.Name,
    			ApplicationType:   pulumi.String("web"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = appinsights.NewAnalyticsItem(ctx, "exampleAnalyticsItem", &appinsights.AnalyticsItemArgs{
    			ApplicationInsightsId: exampleInsights.ID(),
    			Content:               pulumi.String("requests //simple example query"),
    			Scope:                 pulumi.String("shared"),
    			Type:                  pulumi.String("query"),
    		})
    		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.azure.core.ResourceGroup;
    import com.pulumi.azure.core.ResourceGroupArgs;
    import com.pulumi.azure.appinsights.Insights;
    import com.pulumi.azure.appinsights.InsightsArgs;
    import com.pulumi.azure.appinsights.AnalyticsItem;
    import com.pulumi.azure.appinsights.AnalyticsItemArgs;
    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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()        
                .location("West Europe")
                .build());
    
            var exampleInsights = new Insights("exampleInsights", InsightsArgs.builder()        
                .location(exampleResourceGroup.location())
                .resourceGroupName(exampleResourceGroup.name())
                .applicationType("web")
                .build());
    
            var exampleAnalyticsItem = new AnalyticsItem("exampleAnalyticsItem", AnalyticsItemArgs.builder()        
                .applicationInsightsId(exampleInsights.id())
                .content("requests //simple example query")
                .scope("shared")
                .type("query")
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_azure as azure
    
    example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
    example_insights = azure.appinsights.Insights("exampleInsights",
        location=example_resource_group.location,
        resource_group_name=example_resource_group.name,
        application_type="web")
    example_analytics_item = azure.appinsights.AnalyticsItem("exampleAnalyticsItem",
        application_insights_id=example_insights.id,
        content="requests //simple example query",
        scope="shared",
        type="query")
    
    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
    const exampleInsights = new azure.appinsights.Insights("exampleInsights", {
        location: exampleResourceGroup.location,
        resourceGroupName: exampleResourceGroup.name,
        applicationType: "web",
    });
    const exampleAnalyticsItem = new azure.appinsights.AnalyticsItem("exampleAnalyticsItem", {
        applicationInsightsId: exampleInsights.id,
        content: "requests //simple example query",
        scope: "shared",
        type: "query",
    });
    
    resources:
      exampleResourceGroup:
        type: azure:core:ResourceGroup
        properties:
          location: West Europe
      exampleInsights:
        type: azure:appinsights:Insights
        properties:
          location: ${exampleResourceGroup.location}
          resourceGroupName: ${exampleResourceGroup.name}
          applicationType: web
      exampleAnalyticsItem:
        type: azure:appinsights:AnalyticsItem
        properties:
          applicationInsightsId: ${exampleInsights.id}
          content: requests //simple example query
          scope: shared
          type: query
    

    Create AnalyticsItem Resource

    new AnalyticsItem(name: string, args: AnalyticsItemArgs, opts?: CustomResourceOptions);
    @overload
    def AnalyticsItem(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      application_insights_id: Optional[str] = None,
                      content: Optional[str] = None,
                      function_alias: Optional[str] = None,
                      name: Optional[str] = None,
                      scope: Optional[str] = None,
                      type: Optional[str] = None)
    @overload
    def AnalyticsItem(resource_name: str,
                      args: AnalyticsItemArgs,
                      opts: Optional[ResourceOptions] = None)
    func NewAnalyticsItem(ctx *Context, name string, args AnalyticsItemArgs, opts ...ResourceOption) (*AnalyticsItem, error)
    public AnalyticsItem(string name, AnalyticsItemArgs args, CustomResourceOptions? opts = null)
    public AnalyticsItem(String name, AnalyticsItemArgs args)
    public AnalyticsItem(String name, AnalyticsItemArgs args, CustomResourceOptions options)
    
    type: azure:appinsights:AnalyticsItem
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args AnalyticsItemArgs
    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 AnalyticsItemArgs
    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 AnalyticsItemArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AnalyticsItemArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AnalyticsItemArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    AnalyticsItem Resource Properties

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

    Inputs

    The AnalyticsItem resource accepts the following input properties:

    ApplicationInsightsId string
    The ID of the Application Insights component on which the Analytics Item exists. Changing this forces a new resource to be created.
    Content string
    The content for the Analytics Item, for example the query text if type is query.
    Scope string
    The scope for the Analytics Item. Can be shared or user. Changing this forces a new resource to be created. Must be shared for functions.
    Type string
    The type of Analytics Item to create. Can be one of query, function, folder, recent. Changing this forces a new resource to be created.
    FunctionAlias string
    The alias to use for the function. Required when type is function.
    Name string
    Specifies the name of the Application Insights Analytics Item. Changing this forces a new resource to be created.
    ApplicationInsightsId string
    The ID of the Application Insights component on which the Analytics Item exists. Changing this forces a new resource to be created.
    Content string
    The content for the Analytics Item, for example the query text if type is query.
    Scope string
    The scope for the Analytics Item. Can be shared or user. Changing this forces a new resource to be created. Must be shared for functions.
    Type string
    The type of Analytics Item to create. Can be one of query, function, folder, recent. Changing this forces a new resource to be created.
    FunctionAlias string
    The alias to use for the function. Required when type is function.
    Name string
    Specifies the name of the Application Insights Analytics Item. Changing this forces a new resource to be created.
    applicationInsightsId String
    The ID of the Application Insights component on which the Analytics Item exists. Changing this forces a new resource to be created.
    content String
    The content for the Analytics Item, for example the query text if type is query.
    scope String
    The scope for the Analytics Item. Can be shared or user. Changing this forces a new resource to be created. Must be shared for functions.
    type String
    The type of Analytics Item to create. Can be one of query, function, folder, recent. Changing this forces a new resource to be created.
    functionAlias String
    The alias to use for the function. Required when type is function.
    name String
    Specifies the name of the Application Insights Analytics Item. Changing this forces a new resource to be created.
    applicationInsightsId string
    The ID of the Application Insights component on which the Analytics Item exists. Changing this forces a new resource to be created.
    content string
    The content for the Analytics Item, for example the query text if type is query.
    scope string
    The scope for the Analytics Item. Can be shared or user. Changing this forces a new resource to be created. Must be shared for functions.
    type string
    The type of Analytics Item to create. Can be one of query, function, folder, recent. Changing this forces a new resource to be created.
    functionAlias string
    The alias to use for the function. Required when type is function.
    name string
    Specifies the name of the Application Insights Analytics Item. Changing this forces a new resource to be created.
    application_insights_id str
    The ID of the Application Insights component on which the Analytics Item exists. Changing this forces a new resource to be created.
    content str
    The content for the Analytics Item, for example the query text if type is query.
    scope str
    The scope for the Analytics Item. Can be shared or user. Changing this forces a new resource to be created. Must be shared for functions.
    type str
    The type of Analytics Item to create. Can be one of query, function, folder, recent. Changing this forces a new resource to be created.
    function_alias str
    The alias to use for the function. Required when type is function.
    name str
    Specifies the name of the Application Insights Analytics Item. Changing this forces a new resource to be created.
    applicationInsightsId String
    The ID of the Application Insights component on which the Analytics Item exists. Changing this forces a new resource to be created.
    content String
    The content for the Analytics Item, for example the query text if type is query.
    scope String
    The scope for the Analytics Item. Can be shared or user. Changing this forces a new resource to be created. Must be shared for functions.
    type String
    The type of Analytics Item to create. Can be one of query, function, folder, recent. Changing this forces a new resource to be created.
    functionAlias String
    The alias to use for the function. Required when type is function.
    name String
    Specifies the name of the Application Insights Analytics Item. Changing this forces a new resource to be created.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    TimeCreated string
    A string containing the time the Analytics Item was created.
    TimeModified string
    A string containing the time the Analytics Item was last modified.
    Version string
    A string indicating the version of the query format
    Id string
    The provider-assigned unique ID for this managed resource.
    TimeCreated string
    A string containing the time the Analytics Item was created.
    TimeModified string
    A string containing the time the Analytics Item was last modified.
    Version string
    A string indicating the version of the query format
    id String
    The provider-assigned unique ID for this managed resource.
    timeCreated String
    A string containing the time the Analytics Item was created.
    timeModified String
    A string containing the time the Analytics Item was last modified.
    version String
    A string indicating the version of the query format
    id string
    The provider-assigned unique ID for this managed resource.
    timeCreated string
    A string containing the time the Analytics Item was created.
    timeModified string
    A string containing the time the Analytics Item was last modified.
    version string
    A string indicating the version of the query format
    id str
    The provider-assigned unique ID for this managed resource.
    time_created str
    A string containing the time the Analytics Item was created.
    time_modified str
    A string containing the time the Analytics Item was last modified.
    version str
    A string indicating the version of the query format
    id String
    The provider-assigned unique ID for this managed resource.
    timeCreated String
    A string containing the time the Analytics Item was created.
    timeModified String
    A string containing the time the Analytics Item was last modified.
    version String
    A string indicating the version of the query format

    Look up Existing AnalyticsItem Resource

    Get an existing AnalyticsItem resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: AnalyticsItemState, opts?: CustomResourceOptions): AnalyticsItem
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            application_insights_id: Optional[str] = None,
            content: Optional[str] = None,
            function_alias: Optional[str] = None,
            name: Optional[str] = None,
            scope: Optional[str] = None,
            time_created: Optional[str] = None,
            time_modified: Optional[str] = None,
            type: Optional[str] = None,
            version: Optional[str] = None) -> AnalyticsItem
    func GetAnalyticsItem(ctx *Context, name string, id IDInput, state *AnalyticsItemState, opts ...ResourceOption) (*AnalyticsItem, error)
    public static AnalyticsItem Get(string name, Input<string> id, AnalyticsItemState? state, CustomResourceOptions? opts = null)
    public static AnalyticsItem get(String name, Output<String> id, AnalyticsItemState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    ApplicationInsightsId string
    The ID of the Application Insights component on which the Analytics Item exists. Changing this forces a new resource to be created.
    Content string
    The content for the Analytics Item, for example the query text if type is query.
    FunctionAlias string
    The alias to use for the function. Required when type is function.
    Name string
    Specifies the name of the Application Insights Analytics Item. Changing this forces a new resource to be created.
    Scope string
    The scope for the Analytics Item. Can be shared or user. Changing this forces a new resource to be created. Must be shared for functions.
    TimeCreated string
    A string containing the time the Analytics Item was created.
    TimeModified string
    A string containing the time the Analytics Item was last modified.
    Type string
    The type of Analytics Item to create. Can be one of query, function, folder, recent. Changing this forces a new resource to be created.
    Version string
    A string indicating the version of the query format
    ApplicationInsightsId string
    The ID of the Application Insights component on which the Analytics Item exists. Changing this forces a new resource to be created.
    Content string
    The content for the Analytics Item, for example the query text if type is query.
    FunctionAlias string
    The alias to use for the function. Required when type is function.
    Name string
    Specifies the name of the Application Insights Analytics Item. Changing this forces a new resource to be created.
    Scope string
    The scope for the Analytics Item. Can be shared or user. Changing this forces a new resource to be created. Must be shared for functions.
    TimeCreated string
    A string containing the time the Analytics Item was created.
    TimeModified string
    A string containing the time the Analytics Item was last modified.
    Type string
    The type of Analytics Item to create. Can be one of query, function, folder, recent. Changing this forces a new resource to be created.
    Version string
    A string indicating the version of the query format
    applicationInsightsId String
    The ID of the Application Insights component on which the Analytics Item exists. Changing this forces a new resource to be created.
    content String
    The content for the Analytics Item, for example the query text if type is query.
    functionAlias String
    The alias to use for the function. Required when type is function.
    name String
    Specifies the name of the Application Insights Analytics Item. Changing this forces a new resource to be created.
    scope String
    The scope for the Analytics Item. Can be shared or user. Changing this forces a new resource to be created. Must be shared for functions.
    timeCreated String
    A string containing the time the Analytics Item was created.
    timeModified String
    A string containing the time the Analytics Item was last modified.
    type String
    The type of Analytics Item to create. Can be one of query, function, folder, recent. Changing this forces a new resource to be created.
    version String
    A string indicating the version of the query format
    applicationInsightsId string
    The ID of the Application Insights component on which the Analytics Item exists. Changing this forces a new resource to be created.
    content string
    The content for the Analytics Item, for example the query text if type is query.
    functionAlias string
    The alias to use for the function. Required when type is function.
    name string
    Specifies the name of the Application Insights Analytics Item. Changing this forces a new resource to be created.
    scope string
    The scope for the Analytics Item. Can be shared or user. Changing this forces a new resource to be created. Must be shared for functions.
    timeCreated string
    A string containing the time the Analytics Item was created.
    timeModified string
    A string containing the time the Analytics Item was last modified.
    type string
    The type of Analytics Item to create. Can be one of query, function, folder, recent. Changing this forces a new resource to be created.
    version string
    A string indicating the version of the query format
    application_insights_id str
    The ID of the Application Insights component on which the Analytics Item exists. Changing this forces a new resource to be created.
    content str
    The content for the Analytics Item, for example the query text if type is query.
    function_alias str
    The alias to use for the function. Required when type is function.
    name str
    Specifies the name of the Application Insights Analytics Item. Changing this forces a new resource to be created.
    scope str
    The scope for the Analytics Item. Can be shared or user. Changing this forces a new resource to be created. Must be shared for functions.
    time_created str
    A string containing the time the Analytics Item was created.
    time_modified str
    A string containing the time the Analytics Item was last modified.
    type str
    The type of Analytics Item to create. Can be one of query, function, folder, recent. Changing this forces a new resource to be created.
    version str
    A string indicating the version of the query format
    applicationInsightsId String
    The ID of the Application Insights component on which the Analytics Item exists. Changing this forces a new resource to be created.
    content String
    The content for the Analytics Item, for example the query text if type is query.
    functionAlias String
    The alias to use for the function. Required when type is function.
    name String
    Specifies the name of the Application Insights Analytics Item. Changing this forces a new resource to be created.
    scope String
    The scope for the Analytics Item. Can be shared or user. Changing this forces a new resource to be created. Must be shared for functions.
    timeCreated String
    A string containing the time the Analytics Item was created.
    timeModified String
    A string containing the time the Analytics Item was last modified.
    type String
    The type of Analytics Item to create. Can be one of query, function, folder, recent. Changing this forces a new resource to be created.
    version String
    A string indicating the version of the query format

    Import

    Application Insights Analytics Items can be imported using the resource id, e.g.

    $ pulumi import azure:appinsights/analyticsItem:AnalyticsItem example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Insights/components/mycomponent1/analyticsItems/11111111-1111-1111-1111-111111111111
    

    To find the Analytics Item ID you can query the REST API using the az rest CLI command, e.g.

    az rest –method GET –uri “https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/microsoft.insights/components/appinsightstest/analyticsItems?api-version=2015-05-01”

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure Classic v5.66.1 published on Wednesday, Feb 14, 2024 by Pulumi