共用方式為


Remove-AzMetricAlertRuleV2

拿掉 V2(非傳統)計量警示規則。

語法

Remove-AzMetricAlertRuleV2
      -Name <String>
      -ResourceGroupName <String>
      [-PassThru]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzMetricAlertRuleV2
      -ResourceId <String>
      [-PassThru]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzMetricAlertRuleV2
      -InputObject <PSMetricAlertRuleV2>
      [-PassThru]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

Remove-AzMetricAlertRuleV2 Cmdlet 會移除警示規則。 此 Cmdlet 會實作 ShouldProcess 模式,也就是在實際建立、修改或移除資源之前,可能會要求使用者確認。

範例

範例 1:依名稱移除警示規則

Remove-AzMetricAlertRuleV2 -ResourceGroupName xxxxRG -Name PsSdk -PassThru

True

此命令會移除名為 PsSdk 的警示規則

範例 2:依標識符移除警示規則

Remove-AzMetricAlertRuleV2 -ResourceId /subscriptions/00000000-0000-0000-0000-0000000/resourceGroups/metricAlertRG/providers/Microsoft.Insights/metricAlerts/myAlertRule

此命令會移除具有資源標識碼的警示規則 /subscriptions/00000000-0000-0000-0000-0000000/resourceGroups/metricAlertRG/providers/Microsoft.Insights/metricAlerts/myAlertRule

範例 3:取得警示並將其移除

Get-AzMetricAlertRuleV2 -ResourceGroupName alertstest -Name sampleAlertRule | Remove-AzMetricAlertRuleV2

此命令會取得警示並加以移除。

參數

-AsJob

在背景執行 Cmdlet

類型:SwitchParameter
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Confirm

執行 Cmdlet 之前先提示您確認。

類型:SwitchParameter
別名:cf
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-DefaultProfile

用於與 Azure 通訊的認證、帳戶、租用戶和訂用帳戶。

類型:IAzureContextContainer
別名:AzContext, AzureRmContext, AzureCredential
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-InputObject

計量規則物件

類型:PSMetricAlertRuleV2
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-Name

計量警示規則的名稱

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-PassThru

成功刪除時傳回 true。

類型:SwitchParameter
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-ResourceGroupName

The ResourceGroupName

類型:String
別名:ResourceGroup
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-ResourceId

The RuleResourceId

類型:String
別名:RuleResourceId
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-WhatIf

顯示執行 Cmdlet 後會發生的情況。 未執行 Cmdlet。

類型:SwitchParameter
別名:wi
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

輸入

String

PSMetricAlertRuleV2

輸出

Boolean