azure - Log Analytics 工作区 - 要列出的警报

标签 azure powershell

可以像这样使用 az cli 来列出警报

$activities = az monitor activity-log list -g $ResourceGroup

它在 PowerShell 中生成一个字符串,但它是一个 JSON 列表。

有人知道为什么 $activities 不是我可以使用的 PSCustomObject 吗?

最佳答案

我确实同意@Mathias R. Jessen 的观点

az is an executable and executables return strings, not objects

$activities = az monitor activity-log list -g "Resourcegroup"
$res=$activities | ConvertFrom-Json                              
$res

输出:

enter image description here

现在您可以使用点运算符,如下所示:

enter image description here

关于azure - Log Analytics 工作区 - 要列出的警报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75135706/

相关文章:

c# - 使用 Powershell 调用 WCF 服务方法

.net - 当PowerShell溢出时,如何使PowerShell捕获日志文件?

windows - 通过 Add-PrinterPort PowerShell 命令添加 IPP 端口?

powershell - 我应该如何在远程计算机上运行 Powershell 脚本?

azure - 术语 'Get-AzADServicePrincipal' 未被识别为 cmdlet、函数的名称

windows - 我们可以对 Azure VM 虚拟 IP 使用 Route 53 或任何托管 DNS 吗?

powershell - “API版本无效

azure - 还原地理冗余 Azure Blob 存储中的文件

sql-server - 免费云存储来托管 MS Sql

azure - 不支持构造函数 'DisableAttribute(Type)'。为服务总线队列生成函数元数据时出错触发了 Azure 函数