Add-AzMetricAlertRuleV2意外引发错误

问题描述

在使用Az.Monitor(2.2.0)模块创建一堆警报时遇到错误

13:37:31  Add-AzMetricAlertRuleV2 : Exception type: HttpRequestException,Message: An error occurred while sending the request.,13:37:31  Code: Null,Status code:Null,Reason phrase: Null
13:37:31  At C:\Jenkins\workspace\DEPLOY_JOB_PIPELINE\Core\src\Deployment\Monitor\MonitorLibrary.ps1:93 char:22
13:37:31  +         $alertRule = Add-AzMetricAlertRuleV2 `
13:37:31  +                      ~~~~~~~~~~~~~~~~~~~~~~~~~
13:37:31      + CategoryInfo          : CloseError: (:) [Add-AzMetricAlertRuleV2],PSInvalidOperationException
13:37:31      + FullyQualifiedErrorId : Microsoft.Azure.Commands.Insights.Alerts.AddAzureRmMetricAlertRuleV2Command

我的使用方式:

$alertRule = Add-AzMetricAlertRuleV2 `
    -ResourceGroupName $ResourceGroupName `
    -TargetResourceId $TargetResourceId `
    -ActionGroupId $actionGroup.Id `
    -Name $_.Name `
    -Severity $_.Severity `
    -Condition $conditions `
    -Frequency ([System.Xml.XmlConvert]::ToTimeSpan($_.Frequency)) `
    -WindowSize ([System.Xml.XmlConvert]::ToTimeSpan($_.WindowSize)) `
    -Description $_.Description

我正在创建一批超过10条的警报,并且错误出现在批处理的结尾。

我有一个假设,但不确定,我是在致电Connect-AzAccount后10分钟拨打此电话的。上下文是否有可能过期?有什么办法可以解决

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)