Get-AzAlertRule
Gets alert rules.
Syntax
GetByResourceGroup
Get-AzAlertRule
-ResourceGroupName <String>
[-DetailedOutput]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
GetByName
Get-AzAlertRule
-ResourceGroupName <String>
-Name <String>
[-DetailedOutput]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
GetByResourceUri
Get-AzAlertRule
-ResourceGroupName <String>
-TargetResourceId <String>
[-DetailedOutput]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The Get-AzAlertRule 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-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
PS C:\>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
PS C:\>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
Parameter properties
Type: | IAzureContextContainer |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-DetailedOutput
Displays full details in the output.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-Name
Specifies the name of the alert rule to get.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
GetByName
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-ResourceGroupName
Specifies the name of the resource group.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | ResourceGroup |
Parameter sets
(All)
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-TargetResourceId
Specifies the ID of the target resource.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
GetByResourceUri
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.