【问题标题】:Azure Automation Logging to Application InsightAzure 自动化日志记录到 Application Insight
【发布时间】:2016-05-06 06:48:16
【问题描述】:

他们是否可以通过任何方式将自定义跟踪数据从 Azure 自动化发送到应用程序洞察力。

例如:

workflow sample {
    $instrumentationKey = "1234"
    $TelemetryClient = /// how to get the telemetry client based on instrumentation key

    $TelemetryClient.Track("New message")
    $TelemetryClient.Flush()
}

注意:这是来自 Azure 自动化,而不是来自独立脚本

【问题讨论】:

标签: azure automation


【解决方案1】:

成功了

workflow sample {
   InlineScript {
     $assemblyPath = "C:\Modules\Global\Azure\Compute\Microsoft.ApplicationInsights.dll"
     [System.Reflection.Assembly]::LoadFrom($assemblyPath)
     $TelClient = New-Object "Microsoft.ApplicationInsights.TelemetryClient"
     $TelClient.InstrumentationKey = "1234"
     $TelClient.TrackEvent("New message")
     $TelClient.Flush
   }
}

【讨论】:

    猜你喜欢
    • 2022-11-05
    • 2019-12-06
    • 1970-01-01
    • 1970-01-01
    • 2022-01-18
    • 2021-04-18
    • 1970-01-01
    • 1970-01-01
    • 2021-09-21
    相关资源
    最近更新 更多