Get-AzureRmAlertRule

Gets alert rules.

Warning

The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.

Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.

Syntax

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

Description

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

Examples

Example 1: Get alert rules for a resource group

PS C:\>Get-AzureRmAlertRule -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

PS C:\>Get-AzureRmAlertRule -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

PS C:\>Get-AzureRmAlertRule -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: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