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

We recommend using Azure Native.

Azure v6.21.0 published on Friday, Mar 7, 2025 by Pulumi

azure.appinsights.getInsights

Explore with Pulumi AI

We recommend using Azure Native.

Azure v6.21.0 published on Friday, Mar 7, 2025 by Pulumi

Use this data source to access information about an existing Application Insights component.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = azure.appinsights.getInsights({
    name: "production",
    resourceGroupName: "networking",
});
export const applicationInsightsInstrumentationKey = example.then(example => example.instrumentationKey);
Copy
import pulumi
import pulumi_azure as azure

example = azure.appinsights.get_insights(name="production",
    resource_group_name="networking")
pulumi.export("applicationInsightsInstrumentationKey", example.instrumentation_key)
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/appinsights"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := appinsights.LookupInsights(ctx, &appinsights.LookupInsightsArgs{
			Name:              "production",
			ResourceGroupName: "networking",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("applicationInsightsInstrumentationKey", example.InstrumentationKey)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = Azure.AppInsights.GetInsights.Invoke(new()
    {
        Name = "production",
        ResourceGroupName = "networking",
    });

    return new Dictionary<string, object?>
    {
        ["applicationInsightsInstrumentationKey"] = example.Apply(getInsightsResult => getInsightsResult.InstrumentationKey),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.appinsights.AppinsightsFunctions;
import com.pulumi.azure.appinsights.inputs.GetInsightsArgs;
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) {
        final var example = AppinsightsFunctions.getInsights(GetInsightsArgs.builder()
            .name("production")
            .resourceGroupName("networking")
            .build());

        ctx.export("applicationInsightsInstrumentationKey", example.applyValue(getInsightsResult -> getInsightsResult.instrumentationKey()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: azure:appinsights:getInsights
      arguments:
        name: production
        resourceGroupName: networking
outputs:
  applicationInsightsInstrumentationKey: ${example.instrumentationKey}
Copy

Using getInsights

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getInsights(args: GetInsightsArgs, opts?: InvokeOptions): Promise<GetInsightsResult>
function getInsightsOutput(args: GetInsightsOutputArgs, opts?: InvokeOptions): Output<GetInsightsResult>
Copy
def get_insights(name: Optional[str] = None,
                 resource_group_name: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetInsightsResult
def get_insights_output(name: Optional[pulumi.Input[str]] = None,
                 resource_group_name: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetInsightsResult]
Copy
func LookupInsights(ctx *Context, args *LookupInsightsArgs, opts ...InvokeOption) (*LookupInsightsResult, error)
func LookupInsightsOutput(ctx *Context, args *LookupInsightsOutputArgs, opts ...InvokeOption) LookupInsightsResultOutput
Copy

> Note: This function is named LookupInsights in the Go SDK.

public static class GetInsights 
{
    public static Task<GetInsightsResult> InvokeAsync(GetInsightsArgs args, InvokeOptions? opts = null)
    public static Output<GetInsightsResult> Invoke(GetInsightsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetInsightsResult> getInsights(GetInsightsArgs args, InvokeOptions options)
public static Output<GetInsightsResult> getInsights(GetInsightsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: azure:appinsights/getInsights:getInsights
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
Specifies the name of the Application Insights component.
ResourceGroupName This property is required. string
Specifies the name of the resource group the Application Insights component is located in.
Name This property is required. string
Specifies the name of the Application Insights component.
ResourceGroupName This property is required. string
Specifies the name of the resource group the Application Insights component is located in.
name This property is required. String
Specifies the name of the Application Insights component.
resourceGroupName This property is required. String
Specifies the name of the resource group the Application Insights component is located in.
name This property is required. string
Specifies the name of the Application Insights component.
resourceGroupName This property is required. string
Specifies the name of the resource group the Application Insights component is located in.
name This property is required. str
Specifies the name of the Application Insights component.
resource_group_name This property is required. str
Specifies the name of the resource group the Application Insights component is located in.
name This property is required. String
Specifies the name of the Application Insights component.
resourceGroupName This property is required. String
Specifies the name of the resource group the Application Insights component is located in.

getInsights Result

The following output properties are available:

AppId string
The App ID associated with this Application Insights component.
ApplicationType string
The type of the component.
ConnectionString string
The connection string of the Application Insights component. (Sensitive)
Id string
The provider-assigned unique ID for this managed resource.
InstrumentationKey string
The instrumentation key of the Application Insights component.
Location string
The Azure location where the component exists.
Name string
ResourceGroupName string
RetentionInDays int
The retention period in days.
Tags Dictionary<string, string>
Tags applied to the component.
WorkspaceId string
The id of the associated Log Analytics workspace
AppId string
The App ID associated with this Application Insights component.
ApplicationType string
The type of the component.
ConnectionString string
The connection string of the Application Insights component. (Sensitive)
Id string
The provider-assigned unique ID for this managed resource.
InstrumentationKey string
The instrumentation key of the Application Insights component.
Location string
The Azure location where the component exists.
Name string
ResourceGroupName string
RetentionInDays int
The retention period in days.
Tags map[string]string
Tags applied to the component.
WorkspaceId string
The id of the associated Log Analytics workspace
appId String
The App ID associated with this Application Insights component.
applicationType String
The type of the component.
connectionString String
The connection string of the Application Insights component. (Sensitive)
id String
The provider-assigned unique ID for this managed resource.
instrumentationKey String
The instrumentation key of the Application Insights component.
location String
The Azure location where the component exists.
name String
resourceGroupName String
retentionInDays Integer
The retention period in days.
tags Map<String,String>
Tags applied to the component.
workspaceId String
The id of the associated Log Analytics workspace
appId string
The App ID associated with this Application Insights component.
applicationType string
The type of the component.
connectionString string
The connection string of the Application Insights component. (Sensitive)
id string
The provider-assigned unique ID for this managed resource.
instrumentationKey string
The instrumentation key of the Application Insights component.
location string
The Azure location where the component exists.
name string
resourceGroupName string
retentionInDays number
The retention period in days.
tags {[key: string]: string}
Tags applied to the component.
workspaceId string
The id of the associated Log Analytics workspace
app_id str
The App ID associated with this Application Insights component.
application_type str
The type of the component.
connection_string str
The connection string of the Application Insights component. (Sensitive)
id str
The provider-assigned unique ID for this managed resource.
instrumentation_key str
The instrumentation key of the Application Insights component.
location str
The Azure location where the component exists.
name str
resource_group_name str
retention_in_days int
The retention period in days.
tags Mapping[str, str]
Tags applied to the component.
workspace_id str
The id of the associated Log Analytics workspace
appId String
The App ID associated with this Application Insights component.
applicationType String
The type of the component.
connectionString String
The connection string of the Application Insights component. (Sensitive)
id String
The provider-assigned unique ID for this managed resource.
instrumentationKey String
The instrumentation key of the Application Insights component.
location String
The Azure location where the component exists.
name String
resourceGroupName String
retentionInDays Number
The retention period in days.
tags Map<String>
Tags applied to the component.
workspaceId String
The id of the associated Log Analytics workspace

Package Details

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

We recommend using Azure Native.

Azure v6.21.0 published on Friday, Mar 7, 2025 by Pulumi