你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Get-AzAlertRule

Gets classic alert rules.

Syntax

Get-AzAlertRule
   -ResourceGroupName <String>
   [-DetailedOutput]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzAlertRule
   -ResourceGroupName <String>
   -Name <String>
   [-DetailedOutput]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzAlertRule
   -ResourceGroupName <String>
   -TargetResourceId <String>
   [-DetailedOutput]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The Get-AzAlertRule cmdlet gets a classic alert rule by its name or URI, or all classic alert rules from a specified resource group.

Examples

Example 1: Get alert rules for a resource group

Get-AzAlertRule -ResourceGroup "Default-Web-CentralUS"

This command gets all of the alert rules for the resource group named Default-Web-CentralUS. The output does not contain details about the rules because the DetailedOutput parameter is not specified.

Example 2: Get an alert rule by name

Get-AzAlertRule -ResourceGroup "Default-Web-CentralUS" -Name "myalert-7da64548-214d-42ca-b12b-b245bb8f0ac8"

This command gets the alert rule named myalert-7da64548-214d-42ca-b12b-b245bb8f0ac8. Because the DetailedOutput parameter is not specified, the output contains only basic information about the alert rule.

Example 3: Get an alert rule by name with detailed output

Get-AzAlertRule -ResourceGroup "Default-Web-CentralUS" -Name "myalert-7da64548-214d-42ca-b12b-b245bb8f0ac8" -DetailedOutput

This command gets the alert rule named myalert-7da64548-214d-42ca-b12b-b245bb8f0ac8. The DetailedOutput parameter is specified, so the output is detailed.

Parameters

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DetailedOutput

Displays full details in the output.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Name

Specifies the name of the alert rule to get.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ResourceGroupName

Specifies the name of the resource group.

Type:String
Aliases:ResourceGroup
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TargetResourceId

Specifies the ID of the target resource.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Inputs

String

SwitchParameter

Outputs

PSAlertRule