你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Test-AzActionGroup
将测试通知发送到一组提供的接收方
语法
Test-AzActionGroup
-ActionGroupName <String>
-ResourceGroupName <String>
[-SubscriptionId <String>]
-AlertType <String>
-Receiver <IActionGroupReceiver[]>
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Test-AzActionGroup
-InputObject <IActionGroupIdentity>
-AlertType <String>
-Receiver <IActionGroupReceiver[]>
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
将测试通知发送到一组提供的接收方
示例
示例 1:将测试通知发送到提供的接收方
$sms1 = New-AzActionGroupSmsReceiverObject -CountryCode 86 -Name user1 -PhoneNumber 'phonenumber'
$email2 = New-AzActionGroupEmailReceiverObject -EmailAddress user@example.com -Name user2
Test-AzActionGroup -ActionGroupName actiongroup1 -ResourceGroupName monitor-action -AlertType servicehealth -Receiver $email2,$sms1
ActionDetail : {{
"MechanismType": "Email",
"Name": "user2",
"Status": "Succeeded",
"SubState": "Default",
"SendTime": "2023-11-08T05:16:09.6280455+00:00"
}, {
"MechanismType": "Sms",
"Name": "user1",
"Status": "Succeeded",
"SubState": "Default",
"SendTime": "2023-11-08T05:16:09.642967+00:00"
}}
CompletedTime : 2023-11-08T05:18:10.6755827+00:00
ContextNotificationSource : Microsoft.Insights/TestNotification
ContextType : Microsoft.Insights/ServiceHealth
CreatedTime : 2023-11-08T05:16:00.7951739+00:00
State : Complete
此命令将测试通知发送到一组提供的接收方。
参数
-ActionGroupName
操作组的名称。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-AlertType
支持的警报类型的值。 支持的警报类型值为:servicehealth、metricstaticthreshold、metricsdynamicthreshold、logalertv2、smartalert、webtestalert、logalertv1numresult、logalertv1metricmeasurement、resourcehealth、activitylog、actualcostbudget、forecastedbudget
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-AsJob
以作业身份运行命令
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Confirm
在运行 cmdlet 之前,提示你进行确认。
类型: | SwitchParameter |
别名: | cf |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-DefaultProfile
DefaultProfile 参数不起作用。 如果对其他订阅执行 cmdlet,请使用 SubscriptionId 参数。
类型: | PSObject |
别名: | AzureRMContext, AzureCredential |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-InputObject
要构造的标识参数,请参阅 INPUTOBJECT 属性的 NOTES 部分并创建哈希表。
类型: | IActionGroupIdentity |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-NoWait
异步运行命令
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Receiver
属于此操作组的接收方列表。
类型: | IActionGroupReceiver[] |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-ResourceGroupName
资源组的名称。 名称不区分大小写。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-SubscriptionId
目标订阅的 ID。
类型: | String |
Position: | Named |
默认值: | (Get-AzContext).Subscription.Id |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-WhatIf
显示 cmdlet 运行时会发生什么情况。 cmdlet 未运行。
类型: | SwitchParameter |
别名: | wi |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |