Azure 自动化记录到 Application Insight

标签 azure automation

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

例如:

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

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

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

最佳答案

这有效

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,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37039586/

相关文章:

azure - Windows Azure 上的 Umbraco 6.05

.net - Azure 存储表、有关查询和查询处理的问题

java - 如何找到所有元素并一一点击

java - Angular Material - 如何检查 selenium java 中的复选框是否被选中?

javascript - Cucumber生成空白html报告

azure - 无法在 Azure 中启用 "Microsoft.Container Service"

Azure 门户热键

azure - 如何使用 terraform 从 azure key Vault 导入 azure web 应用程序证书

java - TestNG 未在 eclipse 上运行测试

mysql - 自动化 MySQL 字段(如 Excel)