Test-AppInsightsConnection

Tests connectivity to Application Insights by sending a test telemetry event from a specified environment.

Syntax

Default (Default)

Test-AppInsightsConnection
    [-EnvironmentId] <String>
    [-ConnectionString] <String>
    [-Message] <String>
    [[-TenantId] <String>]
    [[-Endpoint] <PPEndpoint>]
    [[-Region] <String>]
    [-ForceAuth]
    [<CommonParameters>]

Description

The Test-AppInsightsConnection cmdlet validates an Application Insights connection string and sends a test telemetry event to the configured Application Insights resource. The test is executed in the context of your delegated subnet in the region that you specify. If the region isn't specified, it defaults to the region of the environment.

Examples

EXAMPLE 1

Test-AppInsightsConnection -EnvironmentId "00000000-0000-0000-0000-000000000000" -ConnectionString "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://westus-0.in.applicationinsights.azure.com/" -Message "Hello from Power Platform"

Sends a test event with the supplied message to Application Insights from the environment's delegated subnet.

EXAMPLE 2

Test-AppInsightsConnection -EnvironmentId "00000000-0000-0000-0000-000000000000" -ConnectionString "InstrumentationKey=...;IngestionEndpoint=https://usgovvirginia-0.in.applicationinsights.azure.us/" -Message "Test" -Endpoint usgovhigh

Sends a test event from an environment in the US Government High cloud.

EXAMPLE 3

Test-AppInsightsConnection -EnvironmentId "00000000-0000-0000-0000-000000000000" -ConnectionString "..." -Message "Test" -Region "westus"

Sends a test event from the westus region instead of the environment's default region.

Parameters

-ConnectionString

The Application Insights connection string to validate and use for the test event.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Endpoint

The Power Platform endpoint to connect to. Defaults to 'prod'.

Parameter properties

Type:PPEndpoint
Default value:Prod
Accepted values:unknown, tip1, tip2, prod, usgovhigh, dod, china
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:5
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EnvironmentId

The Id of the environment to test the Application Insights connection from.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ForceAuth

Force re-authentication to Azure.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Message

The message body to send as the test telemetry event.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Region

The Azure region in which to test the connection. Defaults to the region the environment is in.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:6
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TenantId

The id of the tenant that the environment belongs to.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:4
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

ApplicationInsightsInformation

A class representing the result of the Application Insights connection test.