Edit

Update-AzVmssLifecycleHookEvent

Responds to a Virtual Machine Scale Set (VMSS) lifecycle hook event by approving, rejecting, or delaying it.

Syntax

ByNameParameterSet (Default)

Update-AzVmssLifecycleHookEvent
    -ResourceGroupName <String>
    -VMScaleSetName <String>
    -Name <String>
    [-ActionState <String>]
    [-InstanceId <String[]>]
    [-WaitUntil <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByObjectParameterSet

Update-AzVmssLifecycleHookEvent
    -InputObject <VMScaleSetLifecycleHookEvent>
    [-ActionState <String>]
    [-InstanceId <String[]>]
    [-WaitUntil <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Update-AzVmssLifecycleHookEvent cmdlet responds to a VMSS lifecycle hook event. You can:

  • Approve or reject the event (-ActionState)
  • Approve or reject a subset of VM instances (-InstanceId with -ActionState)
  • Delay the event deadline (-WaitUntil)

The cmdlet accepts pipeline input from Get-AzVmssLifecycleHookEvent.

Examples

Example 1: Approve all targets in an event

Update-AzVmssLifecycleHookEvent -ResourceGroupName 'myRg' -VMScaleSetName 'myVmss' -Name $eventGuid -ActionState Approved

This example approves all target resources in the lifecycle hook event.

Example 2: Reject all targets

Update-AzVmssLifecycleHookEvent -ResourceGroupName 'myRg' -VMScaleSetName 'myVmss' -Name $eventGuid -ActionState Rejected

This example rejects all target resources.

Example 3: Approve a subset of VMs in a Uniform VMSS

Update-AzVmssLifecycleHookEvent -ResourceGroupName 'myRg' -VMScaleSetName 'myVmss' -Name $eventGuid -InstanceId '0','1','2' -ActionState Approved

This example approves VMs with instance IDs 0, 1, and 2 in a Uniform VMSS.

Example 4: Approve a subset of VMs in a Flex VMSS

Update-AzVmssLifecycleHookEvent -ResourceGroupName 'myRg' -VMScaleSetName 'myVmss' -Name $eventGuid -InstanceId 'myvmss_3ec87a','myvmss_a1b2c3' -ActionState Approved

This example approves specific VM names in a Flex VMSS.

Example 5: Delay the event deadline

Update-AzVmssLifecycleHookEvent -ResourceGroupName 'myRg' -VMScaleSetName 'myVmss' -Name $eventGuid -WaitUntil '2026-05-08T11:00:00Z'

This example delays the event deadline to the specified UTC timestamp.

Example 6: Preview what would be approved

Update-AzVmssLifecycleHookEvent -ResourceGroupName 'myRg' -VMScaleSetName 'myVmss' -Name $eventGuid -ActionState Approved -WhatIf

This example shows what the cmdlet would do without making any changes.

Example 7: Approve all active events via pipeline

Get-AzVmssLifecycleHookEvent -ResourceGroupName 'myRg' -VMScaleSetName 'myVmss' |
    Where-Object { $_.Properties.State -eq 'Active' } |
    Update-AzVmssLifecycleHookEvent -ActionState Approved

This example retrieves all active lifecycle hook events and approves each one through the pipeline.

Parameters

-ActionState

The action state to apply to the lifecycle hook event targets. Accepted values: 'Approved', 'Rejected'.

When -InstanceId is not specified, the action is applied to all target resources in the event. When -InstanceId is specified, only the matching targets are updated.

Parameter properties

Type:String
Default value:None
Accepted values:Approved, Rejected
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

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
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

-InputObject

The lifecycle hook event object from 'Get-AzVmssLifecycleHookEvent'. When using this parameter set, the resource group name, VMSS name, and event name are extracted from the object.

Parameter properties

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

Parameter sets

ByObjectParameterSet
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-InstanceId

Filters the update to a subset of target VM instance IDs (decimal IDs for Uniform VMSS) or VM names (for Flex VMSS). When omitted, the action state is applied to all target resources in the event.

Parameter properties

Type:

String[]

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

The name (GUID) of the lifecycle hook event to update.

Parameter properties

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

Parameter sets

ByNameParameterSet
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ResourceGroupName

The name of the resource group.

Parameter properties

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

Parameter sets

ByNameParameterSet
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-VMScaleSetName

The name of the VM scale set.

Parameter properties

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

Parameter sets

ByNameParameterSet
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-WaitUntil

Delays the event deadline to the specified UTC timestamp in ISO 8601 format (for example, '2026-05-08T11:00:00Z'). The timestamp must not exceed the event's MaxWaitUntil value.

Parameter properties

Type:String
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

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
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

VMScaleSetLifecycleHookEvent

String

String

Outputs

VMScaleSetLifecycleHookEvent