给定:
- 我有一个 Azure 帐户(MSDN 权益)。
- 我有一个控制台应用程序,将自定义 AppInsights 指标发送到我的 AppInsights 工作区。
我想从 PowerShell 脚本查询这些指标。
我确实尝试通过谷歌搜索找到解决方案 - 没有成功。并不是说没有关于该主题的帖子 - 我只是无法按照这些帖子使其发挥作用。
问题的要点是如何在没有用户交互的情况下做到这一点。
最佳答案
$WorkspaceName = 'weu-co-law-security-01'
$ResourceGroupName = 'aaa-co-rsg-security-01'
$Workspace = Get-AzOperationalInsightsWorkspace -ResourceGroupName $ResourceGroupName -Name $WorkspaceName
$QueryResults = Invoke-AzOperationalInsightsQuery -Workspace $Workspace -Query 'AuditLogs | where OperationName == "Add member to group" | project TargetResources[0].displayName'
$QueryResults.Results
关于azure - 如何从 Powershell 脚本非交互地运行 Azure Log Analytics 查询?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52373606/