Edit

Share via


Get-AzAlert

Get Alerts Information

Syntax

AlertsListByFilter (Default)

Get-AzAlert
    [-TargetResourceType <String>]
    [-TargetResourceGroup <String>]
    [-MonitorService <String>]
    [-MonitorCondition <String>]
    [-Severity <String>]
    [-State <String>]
    [-AlertRuleId <String>]
    [-SmartGroupId <String>]
    [-IncludeContext <Boolean>]
    [-IncludeEgressConfig <Boolean>]
    [-PageCount <Int32>]
    [-SortBy <String>]
    [-SortOrder <String>]
    [-TimeRange <String>]
    [-CustomTimeRange <String>]
    [-Select <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

AlertById

Get-AzAlert
    -AlertId <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

AlertsListByTargetResourceIdFilter

Get-AzAlert
    [-TargetResourceId <String>]
    [-MonitorService <String>]
    [-MonitorCondition <String>]
    [-Severity <String>]
    [-State <String>]
    [-AlertRuleId <String>]
    [-SmartGroupId <String>]
    [-IncludeContext <Boolean>]
    [-IncludeEgressConfig <Boolean>]
    [-PageCount <Int32>]
    [-SortBy <String>]
    [-SortOrder <String>]
    [-TimeRange <String>]
    [-CustomTimeRange <String>]
    [-Select <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

Get-AzAlert cmdlet gets fired alert instances.

Examples

Example 1

Get-AzAlert -Severity "Sev2" -MonitorCondition "Fired" -IncludeContext $true

List all alerts with Sev2 severity and Fired monitor condition. Setting IncludeContext to true, include custom payload of alert. Use Format-List to get the complete details of each alert in list.

Example 2

Get-AzAlert -AlertId "afbf1b3a-0a6c-4f19-9c9b-644ccd7b1529" | Format-List

Get Alert details by Id (GUID) or Resource Id (Complete ARM Id)

Example 3

Get Alerts Information. (autogenerated)

Get-AzAlert -IncludeContext $true -TimeRange '1h'

Parameters

-AlertId

Unique Identifier of Alert / ResourceId of alert.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:ResourceId

Parameter sets

AlertById
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AlertRuleId

Filter on Alert Rule Id

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AlertsListByFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AlertsListByTargetResourceIdFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CustomTimeRange

Supported format - <start-time>/<end-time> where time is in ISO-8601 format

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AlertsListByFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AlertsListByTargetResourceIdFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-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

-IncludeContext

Include context (custom payload) of alert

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AlertsListByFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AlertsListByTargetResourceIdFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IncludeEgressConfig

Include EgressConfig

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AlertsListByFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AlertsListByTargetResourceIdFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MonitorCondition

Filter on Monitor Condition

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AlertsListByFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AlertsListByTargetResourceIdFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MonitorService

Filter on Monitor Service

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AlertsListByFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AlertsListByTargetResourceIdFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PageCount

Number of alerts to be fetched in a page.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AlertsListByFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AlertsListByTargetResourceIdFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Select

Project the required fields out of essentials. Expected input is comma-separated.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AlertsListByFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AlertsListByTargetResourceIdFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Severity

Filter on Severity of alert

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AlertsListByFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AlertsListByTargetResourceIdFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SmartGroupId

Filter all the alerts having the Smart Group Id

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AlertsListByFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AlertsListByTargetResourceIdFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SortBy

Alert property to use while sorting

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AlertsListByFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AlertsListByTargetResourceIdFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SortOrder

Sort Order

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AlertsListByFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AlertsListByTargetResourceIdFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-State

Filter on State of alert

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AlertsListByFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AlertsListByTargetResourceIdFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TargetResourceGroup

Filter on Resource group name of the target resource of alert.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AlertsListByFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TargetResourceId

Filter on Resource Id of the target resource of alert.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AlertsListByTargetResourceIdFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TargetResourceType

Filter on Resource type of the target resource of alert.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AlertsListByFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TimeRange

Supported time range values - 1h, 1d, 7d, 30d (Default is 1d)

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AlertsListByFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AlertsListByTargetResourceIdFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
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.

Inputs

None

Outputs

PSAlert