你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Enable-AzActivityLogAlert

Enables an activity log alert and sets its Tags.

语法

EnableByNameAndResourceGroup

Enable-AzActivityLogAlert
    -Name <String>
    -ResourceGroupName <String>
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

EnableByInputObject

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.

Example 2: Enable an activity log alert using a PSActivityLogAlertResource object as input

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.

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False
别名:cf

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure

参数属性

类型:IAzureContextContainer
默认值:None
支持通配符:False
不显示:False
别名:AzContext, AzureRmContext, AzureCredential

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-InputObject

Sets the InputObject tags property of the call to extract the required name, resource group name, and the optional tags properties.

参数属性

类型:PSActivityLogAlertResource
默认值:None
支持通配符:False
不显示:False

参数集

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.

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False
别名:wi

参数集

(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.

输入

String

PSActivityLogAlertResource

输出

PSActivityLogAlertResource