Azure自动化日志记录到Application Insight [英] Azure Automation Logging to Application Insight

查看:57
本文介绍了Azure自动化日志记录到Application Insight的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它们是将自定义跟踪数据从Azure自动化发送到应用程序见解的任何方式.

Is their any way to send custom tracking data from Azure Automation to application insight.

例如:

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

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

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

Note: This is from Azure automation and not from standalone script

推荐答案

这有效

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
   }
}

这篇关于Azure自动化日志记录到Application Insight的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆