Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

App Insights should provide a PowerShell Module #78

Open
anblanco opened this issue Nov 19, 2016 · 0 comments
Open

App Insights should provide a PowerShell Module #78

anblanco opened this issue Nov 19, 2016 · 0 comments

Comments

@anblanco
Copy link

Opened from AppInsights Home Issue

As a developer, I would like to use Application Insights from PowerShell, so that I can combine my applications telemetry with any infrastructure telemetry. I also would like to start instrumenting my scripts with Application Insights, so that I can get more insights into how people are using the code I share.

I think there is a lot of value in using App Insights from PowerShell scripts, but there are two areas that could be improved for a more natural PowerShell experience

  1. Creating a new telemetry client
# Today
Add-Type -Path "$Path\lib\net45\Microsoft.ApplicationInsights.dll" 
$ai = New-Object -TypeName Microsoft.ApplicationInsights.TelemetryClient
$ai.InstrumentationKey = "iKey"
# Ideal
$ai = New-TelemetryClient -InstrumentationKey "iKey"
  1. Using Hashtables is more natural in PowerShell, but not supported in the native SDK.
# Today
$ai.TrackEvent('event', @{customProperty='PowerShell!'})

Cannot find an overload for "TrackEvent" and the argument count: "2".
At line:1 char:1
+ $ai.TrackEvent('event', @{customProperty='PowerShell!'})
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest
# Ideal
$ai.TrackEvent('event', @{customProperty='PowerShell!'})

I think that App Insights should provide a PowerShell Module that allows developers / IT pros to more easily collaborate for application telemetry.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant