是否有可能列出Azure的指标警报使用PowerShell?我只能找到:
GET-AzureRmAlertRule
但是,只有给我的“经典”的警报,而不是度量警报我在门户网站。
我可以通过使用metricalerts/listbyresourcegroup终点获得通过API的所有指标警报。
任何人,对于是否有可能通过PowerShell脚本,让他们任何的想法?
你可以尝试使用通用Get-AzureRmResource
cmdlet和资源型过滤器,例如
# Retrieve alert rule
$rule = Get-AzureRmResource -ResourceType Microsoft.Insights/alertRules -ResourceGroupName "myResourceGroup" -Name "my-rule";
# Retrieve alerts for this rule
Get-AzureRmAlertHistory -ResourceId $rule.ResourceId -StartTime (Get-Date).AddHours(-1) -EndTime (Get-Date)