Skip to content

[Compute] Add VMSS Lifecycle Hooks cmdlets (Az.Compute preview)#29574

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/design-review-az-compute-vmss-lifecycle-hooks
Draft

[Compute] Add VMSS Lifecycle Hooks cmdlets (Az.Compute preview)#29574
Copilot wants to merge 3 commits into
mainfrom
copilot/design-review-az-compute-vmss-lifecycle-hooks

Conversation

Copilot AI commented May 12, 2026

Copy link
Copy Markdown
Contributor

Implements the VMSS Lifecycle Hooks feature for Az.Compute (public preview), which lets customers register hooks that fire before Auto OS Upgrade phases and respond (approve/reject/delay) on a per-VM basis before the platform proceeds.

New cmdlets

Cmdlet Purpose
New-AzVmssLifecycleHookConfig Build in-memory LifecycleHook object (no Azure call)
Set-AzVmssLifecycleHooksProfile Attach hooks to a VMSS config/live object; follows existing builder convention (Set-AzVmssOsProfile pattern)
Remove-AzVmssLifecycleHook GET + PUT to remove a hook by -Type or remove all with -All
Get-AzVmssLifecycleHookEvent List/get events; paginates; outputs to pipeline
Update-AzVmssLifecycleHookEvent Approve/reject/delay an event; -InstanceId for per-VM subset; accepts pipeline from Get-AzVmssLifecycleHookEvent

Changed cmdlet

  • New-AzVmssConfig: Added optional -LifecycleHooksProfile <LifecycleHooksProfile> — backward compatible, mirrors how -UpgradePolicy, -AutomaticRepairsPolicy are exposed today.

SDK dependency

All required SDK types (LifecycleHook, LifecycleHooksProfile, VMScaleSetLifecycleHookEvent, VMScaleSetLifecycleHookEventUpdate, VirtualMachineScaleSetLifeCycleHookEventsOperations) are already present in the generated SDK layer. PSVirtualMachineScaleSet gets a new LifecycleHooksProfile property so AutoMapper round-trips it transparently.

End-to-end usage

# Create VMSS with a lifecycle hook
$hook   = New-AzVmssLifecycleHookConfig -Type 'UpgradeAutoOSScheduling' -WaitDuration 'PT8H'
$config = New-AzVmssConfig -Location eastus -SkuCapacity 2
$config = Set-AzVmssLifecycleHooksProfile -VirtualMachineScaleSet $config -LifecycleHook $hook
New-AzVmss -ResourceGroupName myRg -VMScaleSetName myVmss -VirtualMachineScaleSet $config

# Approve every active event in one pipeline
Get-AzVmssLifecycleHookEvent -ResourceGroupName myRg -VMScaleSetName myVmss |
    Where-Object { $_.Properties.State -eq 'Active' } |
    Update-AzVmssLifecycleHookEvent -ActionState Approved

# Remove a hook type
Remove-AzVmssLifecycleHook -ResourceGroupName myRg -VMScaleSetName myVmss -Type UpgradeAutoOSScheduling

Preview note: -DefaultAction Reject and -ActionState Rejected return a server-side error during preview; no client change needed at GA.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 1n8vsblobprodwus2184.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • 5o1vsblobprodwus2115.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • 6yfvsblobprodwus2121.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • 7q7vsblobprodwus2144.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • 7t8vsblobprodwus2168.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • 84hvsblobprodwus2148.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • 8wdvsblobprodwus2137.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • 9yyvsblobprodwus2157.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • b53vsblobprodwus2154.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • ba0vsblobprodwus2130.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • balvsblobprodwus2129.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • cbvvsblobprodwus2131.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • cffvsblobprodwus218.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • d94vsblobprodwus2119.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • ezcvsblobprodwus2170.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • faxvsblobprodwus2122.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • g3xvsblobprodwus2151.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • i01vsblobprodwus216.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • isvvsblobprodwus2147.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • jhgvsblobprodwus2167.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • k4pvsblobprodwus2140.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • ldhvsblobprodwus2153.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • mt2vsblobprodwus2110.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • nudvsblobprodwus214.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • p2tvsblobprodwus2189.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • s8nvsblobprodwus2158.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • tn2vsblobprodwus2124.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • wlnvsblobprodwus2188.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • x0dvsblobprodwus2111.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • y5lvsblobprodwus2179.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • zd2vsblobprodwus2156.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • zt8vsblobprodwus2176.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI self-assigned this May 12, 2026
Copilot AI review requested due to automatic review settings May 12, 2026 14:08
Copilot AI removed the request for review from Copilot May 12, 2026 14:08
@azure-client-tools-bot-prd

Copy link
Copy Markdown
Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

Copilot AI requested review from Copilot and removed request for Copilot May 12, 2026 14:25
Copilot AI requested review from Copilot and removed request for Copilot May 12, 2026 14:27
Copilot AI changed the title [WIP] Implement VMSS lifecycle hooks for Az.Compute [Compute] Add VMSS Lifecycle Hooks cmdlets (Az.Compute preview) May 12, 2026
Copilot AI requested a review from audreyttt May 12, 2026 14:28
{
Type = this.Type,
WaitDuration = waitDuration,
DefaultAction = string.IsNullOrEmpty(this.DefaultAction) ? DefaultDefaultAction : this.DefaultAction

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot add a comment that "Since currently in production, if the customer does no pass defaultAction, we use "Approve" for these types, this works. In the future if we change the default defaultAction in production for any existing / future types, this needs to change"


The cmdlet accepts pipeline input from **Get-AzVmssLifecycleHookEvent**.

> **Preview note:** `-ActionState Rejected` returns a server-side validation error during preview. No client change is required at GA.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot reject is now available, remove this comment


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.

> **Preview note:** 'Rejected' returns a server error during preview.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot reject is now available, remove this comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants