PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,134 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello, we are using logging with Application Insights in our Powershell scripts.
We would like to move and use the Managed Identity with Connection String auth. I couldn't find resources how to do so. https://learn.microsoft.com/en-us/azure/azure-monitor/app/azure-ad-authentication?tabs=net does not show Powershell.
With transition to connection string–based ingestion support I received how to move to using Connection Strings:
Add-Type -Path "c:\users\username}\.nuget\packages\microsoft.applicationinsights\2.20.0\lib\netstandard2.0\Microsoft.ApplicationInsights.dll"
$tconf = New-Object Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration
$tconf.ConnectionString = $config.root.ConnectionString
$tc = New-Object Microsoft.ApplicationInsights.TelemetryClient($tconf)
$tc.TelemetryConfiguration.ConnectionString
$tc.TrackTrace("Sample Trace Message")
$tc.Flush()
Is there a way to provide ClientId of the Identity like we do in C#:
//[...]
var credential = new Azure.Identity.ManagedIdentityCredential(ClientId);
configuration.SetAzureTokenCredential(credential);