We recommend using Azure Native.
azure.appinsights.AnalyticsItem
Explore with Pulumi AI
Manages an Application Insights Analytics Item component.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = new azure.core.ResourceGroup("example", {
    name: "tf-test",
    location: "West Europe",
});
const exampleInsights = new azure.appinsights.Insights("example", {
    name: "tf-test-appinsights",
    location: example.location,
    resourceGroupName: example.name,
    applicationType: "web",
});
const exampleAnalyticsItem = new azure.appinsights.AnalyticsItem("example", {
    name: "testquery",
    applicationInsightsId: exampleInsights.id,
    content: "requests //simple example query",
    scope: "shared",
    type: "query",
});
import pulumi
import pulumi_azure as azure
example = azure.core.ResourceGroup("example",
    name="tf-test",
    location="West Europe")
example_insights = azure.appinsights.Insights("example",
    name="tf-test-appinsights",
    location=example.location,
    resource_group_name=example.name,
    application_type="web")
example_analytics_item = azure.appinsights.AnalyticsItem("example",
    name="testquery",
    application_insights_id=example_insights.id,
    content="requests //simple example query",
    scope="shared",
    type="query")
package main
import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/appinsights"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
			Name:     pulumi.String("tf-test"),
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleInsights, err := appinsights.NewInsights(ctx, "example", &appinsights.InsightsArgs{
			Name:              pulumi.String("tf-test-appinsights"),
			Location:          example.Location,
			ResourceGroupName: example.Name,
			ApplicationType:   pulumi.String("web"),
		})
		if err != nil {
			return err
		}
		_, err = appinsights.NewAnalyticsItem(ctx, "example", &appinsights.AnalyticsItemArgs{
			Name:                  pulumi.String("testquery"),
			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
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() => 
{
    var example = new Azure.Core.ResourceGroup("example", new()
    {
        Name = "tf-test",
        Location = "West Europe",
    });
    var exampleInsights = new Azure.AppInsights.Insights("example", new()
    {
        Name = "tf-test-appinsights",
        Location = example.Location,
        ResourceGroupName = example.Name,
        ApplicationType = "web",
    });
    var exampleAnalyticsItem = new Azure.AppInsights.AnalyticsItem("example", new()
    {
        Name = "testquery",
        ApplicationInsightsId = exampleInsights.Id,
        Content = "requests //simple example query",
        Scope = "shared",
        Type = "query",
    });
});
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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
            .name("tf-test")
            .location("West Europe")
            .build());
        var exampleInsights = new Insights("exampleInsights", InsightsArgs.builder()
            .name("tf-test-appinsights")
            .location(example.location())
            .resourceGroupName(example.name())
            .applicationType("web")
            .build());
        var exampleAnalyticsItem = new AnalyticsItem("exampleAnalyticsItem", AnalyticsItemArgs.builder()
            .name("testquery")
            .applicationInsightsId(exampleInsights.id())
            .content("requests //simple example query")
            .scope("shared")
            .type("query")
            .build());
    }
}
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: tf-test
      location: West Europe
  exampleInsights:
    type: azure:appinsights:Insights
    name: example
    properties:
      name: tf-test-appinsights
      location: ${example.location}
      resourceGroupName: ${example.name}
      applicationType: web
  exampleAnalyticsItem:
    type: azure:appinsights:AnalyticsItem
    name: example
    properties:
      name: testquery
      applicationInsightsId: ${exampleInsights.id}
      content: requests //simple example query
      scope: shared
      type: query
Create AnalyticsItem Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new AnalyticsItem(name: string, args: AnalyticsItemArgs, opts?: CustomResourceOptions);@overload
def AnalyticsItem(resource_name: str,
                  args: AnalyticsItemArgs,
                  opts: Optional[ResourceOptions] = None)
@overload
def AnalyticsItem(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  application_insights_id: Optional[str] = None,
                  content: Optional[str] = None,
                  scope: Optional[str] = None,
                  type: Optional[str] = None,
                  function_alias: Optional[str] = None,
                  name: Optional[str] = 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.
Parameters
- 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.
 
Constructor example
The following reference example uses placeholder values for all input properties.
var analyticsItemResource = new Azure.AppInsights.AnalyticsItem("analyticsItemResource", new()
{
    ApplicationInsightsId = "string",
    Content = "string",
    Scope = "string",
    Type = "string",
    FunctionAlias = "string",
    Name = "string",
});
example, err := appinsights.NewAnalyticsItem(ctx, "analyticsItemResource", &appinsights.AnalyticsItemArgs{
	ApplicationInsightsId: pulumi.String("string"),
	Content:               pulumi.String("string"),
	Scope:                 pulumi.String("string"),
	Type:                  pulumi.String("string"),
	FunctionAlias:         pulumi.String("string"),
	Name:                  pulumi.String("string"),
})
var analyticsItemResource = new AnalyticsItem("analyticsItemResource", AnalyticsItemArgs.builder()
    .applicationInsightsId("string")
    .content("string")
    .scope("string")
    .type("string")
    .functionAlias("string")
    .name("string")
    .build());
analytics_item_resource = azure.appinsights.AnalyticsItem("analyticsItemResource",
    application_insights_id="string",
    content="string",
    scope="string",
    type="string",
    function_alias="string",
    name="string")
const analyticsItemResource = new azure.appinsights.AnalyticsItem("analyticsItemResource", {
    applicationInsightsId: "string",
    content: "string",
    scope: "string",
    type: "string",
    functionAlias: "string",
    name: "string",
});
type: azure:appinsights:AnalyticsItem
properties:
    applicationInsightsId: string
    content: string
    functionAlias: string
    name: string
    scope: string
    type: string
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:
- Application
Insights stringId  - 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 
typeisquery. - Scope string
 - The scope for the Analytics Item. Can be 
sharedoruser. Changing this forces a new resource to be created. Must besharedfor 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. - Function
Alias string - The alias to use for the function. Required when 
typeisfunction. - Name string
 - Specifies the name of the Application Insights Analytics Item. Changing this forces a new resource to be created.
 
- Application
Insights stringId  - 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 
typeisquery. - Scope string
 - The scope for the Analytics Item. Can be 
sharedoruser. Changing this forces a new resource to be created. Must besharedfor 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. - Function
Alias string - The alias to use for the function. Required when 
typeisfunction. - Name string
 - Specifies the name of the Application Insights Analytics Item. Changing this forces a new resource to be created.
 
- application
Insights StringId  - 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 
typeisquery. - scope String
 - The scope for the Analytics Item. Can be 
sharedoruser. Changing this forces a new resource to be created. Must besharedfor 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. - function
Alias String - The alias to use for the function. Required when 
typeisfunction. - name String
 - Specifies the name of the Application Insights Analytics Item. Changing this forces a new resource to be created.
 
- application
Insights stringId  - 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 
typeisquery. - scope string
 - The scope for the Analytics Item. Can be 
sharedoruser. Changing this forces a new resource to be created. Must besharedfor 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. - function
Alias string - The alias to use for the function. Required when 
typeisfunction. - name string
 - Specifies the name of the Application Insights Analytics Item. Changing this forces a new resource to be created.
 
- application_
insights_ strid  - 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 
typeisquery. - scope str
 - The scope for the Analytics Item. Can be 
sharedoruser. Changing this forces a new resource to be created. Must besharedfor 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 
typeisfunction. - name str
 - Specifies the name of the Application Insights Analytics Item. Changing this forces a new resource to be created.
 
- application
Insights StringId  - 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 
typeisquery. - scope String
 - The scope for the Analytics Item. Can be 
sharedoruser. Changing this forces a new resource to be created. Must besharedfor 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. - function
Alias String - The alias to use for the function. Required when 
typeisfunction. - 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.
 - Time
Created string - A string containing the time the Analytics Item was created.
 - Time
Modified 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.
 - Time
Created string - A string containing the time the Analytics Item was created.
 - Time
Modified 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.
 - time
Created String - A string containing the time the Analytics Item was created.
 - time
Modified 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.
 - time
Created string - A string containing the time the Analytics Item was created.
 - time
Modified 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.
 - time
Created String - A string containing the time the Analytics Item was created.
 - time
Modified 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) -> AnalyticsItemfunc 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.
 
- Application
Insights stringId  - 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 
typeisquery. - Function
Alias string - The alias to use for the function. Required when 
typeisfunction. - 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 
sharedoruser. Changing this forces a new resource to be created. Must besharedfor functions. - Time
Created string - A string containing the time the Analytics Item was created.
 - Time
Modified 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 stringId  - 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 
typeisquery. - Function
Alias string - The alias to use for the function. Required when 
typeisfunction. - 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 
sharedoruser. Changing this forces a new resource to be created. Must besharedfor functions. - Time
Created string - A string containing the time the Analytics Item was created.
 - Time
Modified 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 StringId  - 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 
typeisquery. - function
Alias String - The alias to use for the function. Required when 
typeisfunction. - 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 
sharedoruser. Changing this forces a new resource to be created. Must besharedfor functions. - time
Created String - A string containing the time the Analytics Item was created.
 - time
Modified 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 stringId  - 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 
typeisquery. - function
Alias string - The alias to use for the function. Required when 
typeisfunction. - 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 
sharedoruser. Changing this forces a new resource to be created. Must besharedfor functions. - time
Created string - A string containing the time the Analytics Item was created.
 - time
Modified 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_ strid  - 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 
typeisquery. - function_
alias str - The alias to use for the function. Required when 
typeisfunction. - 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 
sharedoruser. Changing this forces a new resource to be created. Must besharedfor 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
 
- application
Insights StringId  - 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 
typeisquery. - function
Alias String - The alias to use for the function. Required when 
typeisfunction. - 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 
sharedoruser. Changing this forces a new resource to be created. Must besharedfor functions. - time
Created String - A string containing the time the Analytics Item was created.
 - time
Modified 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”
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
 - Azure Classic pulumi/pulumi-azure
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
azurermTerraform Provider.