Skip to content

Add -ForceDeallocate support to Stop-AzVM - #29890

Draft
haagha with Copilot wants to merge 2 commits into
mainfrom
copilot/az-compute-force-deallocate
Draft

Add -ForceDeallocate support to Stop-AzVM#29890
haagha with Copilot wants to merge 2 commits into
mainfrom
copilot/az-compute-force-deallocate

Conversation

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

This updates Stop-AzVM to expose the new -ForceDeallocate stop behavior for VM deallocation scenarios. The change keeps the existing stop/power-off flows intact while making the new option available only where the Compute API supports it.

  • Cmdlet surface

    • Added -ForceDeallocate to Stop-AzVM.
    • Scoped the parameter to deallocate paths only.
    • Kept -StayProvisioned / -SkipShutdown on the power-off path, so unsupported combinations are rejected by parameter binding instead of reaching the service.
  • Execution flow

    • Wired -ForceDeallocate through the VM deallocate and hibernate calls.
    • Preserved existing -NoWait, -Force, and -Id behavior.
    • Updated the id-based stop path so the new deallocate parameter sets resolve resource group and VM name correctly.
  • Docs

    • Updated Stop-AzVM help syntax and parameter reference.
    • Added an example showing force deallocation during stop.
    • Added a Compute changelog entry for the new parameter.
  • Scenario coverage

    • Added focused coverage for:
      • -ForceDeallocate on resource-group and id parameter sets
      • -ForceDeallocate combined with -Hibernate
      • rejection of invalid combinations with -StayProvisioned and -SkipShutdown
      • preservation of existing stop syntax

Example:

Stop-AzVM -ResourceGroupName "testRG" -Name "testVM" -ForceDeallocate

Verification Checklist

  • Cmdlet implementation updated with the new/changed parameter(s)
  • Model class updated to represent the API schema
  • Help content regenerated: new parameter appears in the SYNTAX section and in alphabetical order in the PARAMETERS section
  • Examples updated to cover the new parameter(s)
  • If adding a new command, add it to the help/Az.Compute.md file
  • If adding a new command, register it in Az.Compute.psd1 (CmdletsToExport, alphabetical order)
  • New scenario tests cover the full matrix: each new parameter exercised alone and in combination (may share a single test), every affected cmdlet, Update merge semantics, removal/disable paths, and negative/edge cases (mutually exclusive params; $null/empty inputs validated per [ValidateNotNullOrEmpty] or other validation attributes)
  • Test assertions check concrete sub-properties (type/enum, collection counts and membership, computed fields) and re-read the resource with a follow-up Get-* call to confirm the values persisted
  • Every new .ps1 scenario function is wired into the .cs file as a [Fact] check-in test
  • ChangeLog.md updated with a concise, user-focused entry under ## Upcoming Release

Copilot AI self-assigned this Jul 23, 2026
Copilot AI review requested due to automatic review settings July 23, 2026 16:24
Copilot AI removed the request for review from Copilot July 23, 2026 16:24
@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI requested review from Copilot and removed request for Copilot July 23, 2026 16:35
Copilot AI changed the title [WIP] Add cmdlets for Az.Compute - ForceDeallocate Add -ForceDeallocate support to Stop-AzVM Jul 23, 2026
Copilot AI requested a review from haagha July 23, 2026 16:36
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.

Get-AzureVMAvailableExtension for ARM #1481 - Closed without Solution

2 participants