1. Packages
  2. Azure Native
  3. API Docs
  4. applicationinsights
  5. AnalyticsItem
This is the latest version of Azure Native. Use the Azure Native v2 docs if using the v2 version of this package.
Azure Native v3.1.0 published on Tuesday, Apr 8, 2025 by Pulumi

azure-native.applicationinsights.AnalyticsItem

Explore with Pulumi AI

This is the latest version of Azure Native. Use the Azure Native v2 docs if using the v2 version of this package.
Azure Native v3.1.0 published on Tuesday, Apr 8, 2025 by Pulumi

Properties that define an Analytics item that is associated to an Application Insights component.

Uses Azure REST API version 2015-05-01.

Example Usage

AnalyticsItemPut

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;

return await Deployment.RunAsync(() => 
{
    var analyticsItem = new AzureNative.ApplicationInsights.AnalyticsItem("analyticsItem", new()
    {
        Content = @"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
",
        Name = "Exceptions - New in the last 24 hours",
        ResourceGroupName = "my-resource-group",
        ResourceName = "my-component",
        Scope = AzureNative.ApplicationInsights.ItemScope.Shared,
        ScopePath = "analyticsItems",
        Type = AzureNative.ApplicationInsights.ItemType.Query,
    });

});
Copy
package main

import (
	applicationinsights "github.com/pulumi/pulumi-azure-native-sdk/applicationinsights/v3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := applicationinsights.NewAnalyticsItem(ctx, "analyticsItem", &applicationinsights.AnalyticsItemArgs{
			Content: pulumi.String(`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
`),
			Name:              pulumi.String("Exceptions - New in the last 24 hours"),
			ResourceGroupName: pulumi.String("my-resource-group"),
			ResourceName:      pulumi.String("my-component"),
			Scope:             pulumi.String(applicationinsights.ItemScopeShared),
			ScopePath:         pulumi.String("analyticsItems"),
			Type:              pulumi.String(applicationinsights.ItemTypeQuery),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.applicationinsights.AnalyticsItem;
import com.pulumi.azurenative.applicationinsights.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 analyticsItem = new AnalyticsItem("analyticsItem", AnalyticsItemArgs.builder()
            .content("""
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
            """)
            .name("Exceptions - New in the last 24 hours")
            .resourceGroupName("my-resource-group")
            .resourceName("my-component")
            .scope("shared")
            .scopePath("analyticsItems")
            .type("query")
            .build());

    }
}
Copy
import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const analyticsItem = new azure_native.applicationinsights.AnalyticsItem("analyticsItem", {
    content: `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
`,
    name: "Exceptions - New in the last 24 hours",
    resourceGroupName: "my-resource-group",
    resourceName: "my-component",
    scope: azure_native.applicationinsights.ItemScope.Shared,
    scopePath: "analyticsItems",
    type: azure_native.applicationinsights.ItemType.Query,
});
Copy
import pulumi
import pulumi_azure_native as azure_native

analytics_item = azure_native.applicationinsights.AnalyticsItem("analyticsItem",
    content="""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
""",
    name="Exceptions - New in the last 24 hours",
    resource_group_name="my-resource-group",
    resource_name_="my-component",
    scope=azure_native.applicationinsights.ItemScope.SHARED,
    scope_path="analyticsItems",
    type=azure_native.applicationinsights.ItemType.QUERY)
Copy
resources:
  analyticsItem:
    type: azure-native:applicationinsights:AnalyticsItem
    properties:
      content: "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"
      name: Exceptions - New in the last 24 hours
      resourceGroupName: my-resource-group
      resourceName: my-component
      scope: shared
      scopePath: analyticsItems
      type: query
Copy

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,
                  resource_group_name: Optional[str] = None,
                  resource_name_: Optional[str] = None,
                  scope_path: Optional[str] = None,
                  content: Optional[str] = None,
                  id: Optional[str] = None,
                  name: Optional[str] = None,
                  override_item: Optional[bool] = None,
                  properties: Optional[ApplicationInsightsComponentAnalyticsItemPropertiesArgs] = None,
                  scope: Optional[Union[str, ItemScope]] = None,
                  type: Optional[Union[str, ItemType]] = 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-native:applicationinsights:AnalyticsItem
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. AnalyticsItemArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. 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 This property is required. string
The unique name of the resource.
args This property is required. AnalyticsItemArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. AnalyticsItemArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. 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 AzureNative.ApplicationInsights.AnalyticsItem("analyticsItemResource", new()
{
    ResourceGroupName = "string",
    ResourceName = "string",
    ScopePath = "string",
    Content = "string",
    Id = "string",
    Name = "string",
    OverrideItem = false,
    Properties = new AzureNative.ApplicationInsights.Inputs.ApplicationInsightsComponentAnalyticsItemPropertiesArgs
    {
        FunctionAlias = "string",
    },
    Scope = "string",
    Type = "string",
});
Copy
example, err := applicationinsights.NewAnalyticsItem(ctx, "analyticsItemResource", &applicationinsights.AnalyticsItemArgs{
	ResourceGroupName: pulumi.String("string"),
	ResourceName:      pulumi.String("string"),
	ScopePath:         pulumi.String("string"),
	Content:           pulumi.String("string"),
	Id:                pulumi.String("string"),
	Name:              pulumi.String("string"),
	OverrideItem:      pulumi.Bool(false),
	Properties: &applicationinsights.ApplicationInsightsComponentAnalyticsItemPropertiesArgs{
		FunctionAlias: pulumi.String("string"),
	},
	Scope: pulumi.String("string"),
	Type:  pulumi.String("string"),
})
Copy
var analyticsItemResource = new AnalyticsItem("analyticsItemResource", AnalyticsItemArgs.builder()
    .resourceGroupName("string")
    .resourceName("string")
    .scopePath("string")
    .content("string")
    .id("string")
    .name("string")
    .overrideItem(false)
    .properties(ApplicationInsightsComponentAnalyticsItemPropertiesArgs.builder()
        .functionAlias("string")
        .build())
    .scope("string")
    .type("string")
    .build());
Copy
analytics_item_resource = azure_native.applicationinsights.AnalyticsItem("analyticsItemResource",
    resource_group_name="string",
    resource_name_="string",
    scope_path="string",
    content="string",
    id="string",
    name="string",
    override_item=False,
    properties={
        "function_alias": "string",
    },
    scope="string",
    type="string")
Copy
const analyticsItemResource = new azure_native.applicationinsights.AnalyticsItem("analyticsItemResource", {
    resourceGroupName: "string",
    resourceName: "string",
    scopePath: "string",
    content: "string",
    id: "string",
    name: "string",
    overrideItem: false,
    properties: {
        functionAlias: "string",
    },
    scope: "string",
    type: "string",
});
Copy
type: azure-native:applicationinsights:AnalyticsItem
properties:
    content: string
    id: string
    name: string
    overrideItem: false
    properties:
        functionAlias: string
    resourceGroupName: string
    resourceName: string
    scope: string
    scopePath: string
    type: string
Copy

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

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

The AnalyticsItem resource accepts the following input properties:

ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group. The name is case insensitive.
ResourceName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Application Insights component resource.
ScopePath
This property is required.
Changes to this property will trigger replacement.
string
Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component.
Content string
The content of this item
Id string
Internally assigned unique id of the item definition.
Name string
The user-defined name of the item.
OverrideItem bool
Flag indicating whether or not to force save an item. This allows overriding an item if it already exists.
Properties Pulumi.AzureNative.ApplicationInsights.Inputs.ApplicationInsightsComponentAnalyticsItemProperties
A set of properties that can be defined in the context of a specific item type. Each type may have its own properties.
Scope string | Pulumi.AzureNative.ApplicationInsights.ItemScope
Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component.
Type string | Pulumi.AzureNative.ApplicationInsights.ItemType
Enum indicating the type of the Analytics item.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group. The name is case insensitive.
ResourceName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Application Insights component resource.
ScopePath
This property is required.
Changes to this property will trigger replacement.
string
Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component.
Content string
The content of this item
Id string
Internally assigned unique id of the item definition.
Name string
The user-defined name of the item.
OverrideItem bool
Flag indicating whether or not to force save an item. This allows overriding an item if it already exists.
Properties ApplicationInsightsComponentAnalyticsItemPropertiesArgs
A set of properties that can be defined in the context of a specific item type. Each type may have its own properties.
Scope string | ItemScope
Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component.
Type string | ItemType
Enum indicating the type of the Analytics item.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group. The name is case insensitive.
resourceName
This property is required.
Changes to this property will trigger replacement.
String
The name of the Application Insights component resource.
scopePath
This property is required.
Changes to this property will trigger replacement.
String
Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component.
content String
The content of this item
id String
Internally assigned unique id of the item definition.
name String
The user-defined name of the item.
overrideItem Boolean
Flag indicating whether or not to force save an item. This allows overriding an item if it already exists.
properties ApplicationInsightsComponentAnalyticsItemProperties
A set of properties that can be defined in the context of a specific item type. Each type may have its own properties.
scope String | ItemScope
Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component.
type String | ItemType
Enum indicating the type of the Analytics item.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group. The name is case insensitive.
resourceName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Application Insights component resource.
scopePath
This property is required.
Changes to this property will trigger replacement.
string
Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component.
content string
The content of this item
id string
Internally assigned unique id of the item definition.
name string
The user-defined name of the item.
overrideItem boolean
Flag indicating whether or not to force save an item. This allows overriding an item if it already exists.
properties ApplicationInsightsComponentAnalyticsItemProperties
A set of properties that can be defined in the context of a specific item type. Each type may have its own properties.
scope string | ItemScope
Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component.
type string | ItemType
Enum indicating the type of the Analytics item.
resource_group_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the resource group. The name is case insensitive.
resource_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the Application Insights component resource.
scope_path
This property is required.
Changes to this property will trigger replacement.
str
Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component.
content str
The content of this item
id str
Internally assigned unique id of the item definition.
name str
The user-defined name of the item.
override_item bool
Flag indicating whether or not to force save an item. This allows overriding an item if it already exists.
properties ApplicationInsightsComponentAnalyticsItemPropertiesArgs
A set of properties that can be defined in the context of a specific item type. Each type may have its own properties.
scope str | ItemScope
Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component.
type str | ItemType
Enum indicating the type of the Analytics item.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group. The name is case insensitive.
resourceName
This property is required.
Changes to this property will trigger replacement.
String
The name of the Application Insights component resource.
scopePath
This property is required.
Changes to this property will trigger replacement.
String
Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component.
content String
The content of this item
id String
Internally assigned unique id of the item definition.
name String
The user-defined name of the item.
overrideItem Boolean
Flag indicating whether or not to force save an item. This allows overriding an item if it already exists.
properties Property Map
A set of properties that can be defined in the context of a specific item type. Each type may have its own properties.
scope String | "shared" | "user"
Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component.
type String | "none" | "query" | "recent" | "function"
Enum indicating the type of the Analytics item.

Outputs

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

AzureApiVersion string
The Azure API version of the resource.
Id string
The provider-assigned unique ID for this managed resource.
TimeCreated string
Date and time in UTC when this item was created.
TimeModified string
Date and time in UTC of the last modification that was made to this item.
Version string
This instance's version of the data model. This can change as new features are added.
AzureApiVersion string
The Azure API version of the resource.
Id string
The provider-assigned unique ID for this managed resource.
TimeCreated string
Date and time in UTC when this item was created.
TimeModified string
Date and time in UTC of the last modification that was made to this item.
Version string
This instance's version of the data model. This can change as new features are added.
azureApiVersion String
The Azure API version of the resource.
id String
The provider-assigned unique ID for this managed resource.
timeCreated String
Date and time in UTC when this item was created.
timeModified String
Date and time in UTC of the last modification that was made to this item.
version String
This instance's version of the data model. This can change as new features are added.
azureApiVersion string
The Azure API version of the resource.
id string
The provider-assigned unique ID for this managed resource.
timeCreated string
Date and time in UTC when this item was created.
timeModified string
Date and time in UTC of the last modification that was made to this item.
version string
This instance's version of the data model. This can change as new features are added.
azure_api_version str
The Azure API version of the resource.
id str
The provider-assigned unique ID for this managed resource.
time_created str
Date and time in UTC when this item was created.
time_modified str
Date and time in UTC of the last modification that was made to this item.
version str
This instance's version of the data model. This can change as new features are added.
azureApiVersion String
The Azure API version of the resource.
id String
The provider-assigned unique ID for this managed resource.
timeCreated String
Date and time in UTC when this item was created.
timeModified String
Date and time in UTC of the last modification that was made to this item.
version String
This instance's version of the data model. This can change as new features are added.

Supporting Types

ApplicationInsightsComponentAnalyticsItemProperties
, ApplicationInsightsComponentAnalyticsItemPropertiesArgs

FunctionAlias string
A function alias, used when the type of the item is Function
FunctionAlias string
A function alias, used when the type of the item is Function
functionAlias String
A function alias, used when the type of the item is Function
functionAlias string
A function alias, used when the type of the item is Function
function_alias str
A function alias, used when the type of the item is Function
functionAlias String
A function alias, used when the type of the item is Function

ApplicationInsightsComponentAnalyticsItemPropertiesResponse
, ApplicationInsightsComponentAnalyticsItemPropertiesResponseArgs

FunctionAlias string
A function alias, used when the type of the item is Function
FunctionAlias string
A function alias, used when the type of the item is Function
functionAlias String
A function alias, used when the type of the item is Function
functionAlias string
A function alias, used when the type of the item is Function
function_alias str
A function alias, used when the type of the item is Function
functionAlias String
A function alias, used when the type of the item is Function

ItemScope
, ItemScopeArgs

Shared
shared
User
user
ItemScopeShared
shared
ItemScopeUser
user
Shared
shared
User
user
Shared
shared
User
user
SHARED
shared
USER
user
"shared"
shared
"user"
user

ItemType
, ItemTypeArgs

None
none
Query
query
Recent
recent
Function
function
ItemTypeNone
none
ItemTypeQuery
query
ItemTypeRecent
recent
ItemTypeFunction
function
None
none
Query
query
Recent
recent
Function
function
None
none
Query
query
Recent
recent
Function
function
NONE
none
QUERY
query
RECENT
recent
FUNCTION
function
"none"
none
"query"
query
"recent"
recent
"function"
function

Import

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

$ pulumi import azure-native:applicationinsights:AnalyticsItem myresource1 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item 
Copy

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

Package Details

Repository
Azure Native pulumi/pulumi-azure-native
License
Apache-2.0
This is the latest version of Azure Native. Use the Azure Native v2 docs if using the v2 version of this package.
Azure Native v3.1.0 published on Tuesday, Apr 8, 2025 by Pulumi