繁体   English   中英

从 VM PowerShell 查询 Azure Log Analytics

[英]Querying Azure Log Analytics from VM PowerShell

我想让我的本地设备从它报告的同一个 Log Analytics 平台查询和存储数据。 All the documentation I have seen shows me how to access/query Log Analytics from the Azure UI & Azure PowerShell, but I have not seen anything on how to query the same data from the Virtual Machine's own PowerShell terminal. 有什么建议吗? 这可能吗?

我找到了自己问题的答案。 为了任何在同一问题上苦苦挣扎的人的利益,请参阅:

https://igeorgiev.eu/azure/howto-query-log-analytics-workspace-from-azure-powershell-using-service-principal/

可以使用以下方式检索 Log Analytics 工作区上下文

$workspace = Get-AzOperationalInsightsWorkspace

检索上下文并定义 KQL 查询后,您可以使用以下命令查询 Log Analytics 平台

$QueryResults = Invoke-AzOperationalInsightsQuery -Workspace $Workspace -Query $kqlQuery

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM