Powershell Add-AzMetricAlertRuleV2意外抛出错误

Powershell Add-AzMetricAlertRuleV2意外抛出错误,powershell,azure-powershell,powershell-az-module,Powershell,Azure Powershell,Powershell Az Module,我在使用Az.Monitor(2.2.0)模块创建一系列警报时遇到错误 我使用它的方式: $alertRule = Add-AzMetricAlertRuleV2 ` -ResourceGroupName $ResourceGroupName ` -TargetResourceId $TargetResourceId ` -ActionGroupId $actionGroup.Id ` -Name $_.Name ` -Severity $_.Severi

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

我使用它的方式:

$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 AzaAccount 10分钟后打的。上下文是否可能过期?有什么方法可以修复它吗?

您可以在设置了调试参数的情况下运行该命令,看看是否有关于该错误的更多信息吗?
$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