Enable-AzActivityLogAlert
Enables an activity log alert and sets its Tags.
语法
EnableByNameAndResourceGroup
Enable-AzActivityLogAlert
-Name <String>
-ResourceGroupName <String>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Enable-AzActivityLogAlert
-InputObject <PSActivityLogAlertResource>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
EnableByResourceId
Enable-AzActivityLogAlert
-ResourceId <String>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
The Enable-AzActivityLogAlert cmdlet allows enabling an activity log alert and setting its tags.
This cmdlet implements the ShouldProcess pattern, i.e. it might request confirmation from the user before actually patching the resource.
示例
Example 1: Enable an activity log alert
PS C:\>Enable-AzActivityLogAlert -Name "alert1" -ResourceGroupName "Default-ActivityLogsAlerts"
This command enables the activity log alert called alert1 in the resource group Default-ActivityLogsAlerts.
PS C:\>$obj = Get-AzActivityLogAlert -ResourceGroup "Default-activityLogAlerts" -Name "alert1"
PS C:\>Enable-AzActivityLogAlert -InputObject $obj
This command enables an activity log alert called alert1. For this it uses a PSActivityLogAlertResource object as input argument.
Example 3: Enable the ActivityLogAlert using the ResourceId parameter
PS C:\>Get-AzResource -ResourceGroupName "myResourceGroup" -Name "myLogAlert" | Enable-AzActivityLogAlert
This command enables the ActivityLogAlert using the ResourceId parameter from the pipe.
参数
-Confirm
Prompts you for confirmation before running the cmdlet.
参数属性
参数集
(All)
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure
参数属性
参数集
(All)
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
Sets the InputObject tags property of the call to extract the required name, resource group name, and the optional tags properties.
EnableByInputObject
Position: Named
必需: True
来自管道的值: True
来自管道的值(按属性名称): False
来自剩余参数的值: False
-Name
The name of the activity log alert.
参数属性
类型: String
默认值: None
支持通配符: False
不显示: False
参数集
EnableByNameAndResourceGroup
Position: Named
必需: True
来自管道的值: False
来自管道的值(按属性名称): True
来自剩余参数的值: False
-ResourceGroupName
The name of the resource group where the alert resource is going to exist.
参数属性
类型: String
默认值: None
支持通配符: False
不显示: False
参数集
EnableByNameAndResourceGroup
Position: Named
必需: True
来自管道的值: False
来自管道的值(按属性名称): True
来自剩余参数的值: False
-ResourceId
Sets the ResourceId tags property of the call to extract the required name, resource group name properties.
参数属性
类型: String
默认值: None
支持通配符: False
不显示: False
参数集
EnableByResourceId
Position: Named
必需: True
来自管道的值: False
来自管道的值(按属性名称): True
来自剩余参数的值: False
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
参数属性
参数集
(All)
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: 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 .
输出