Skip to content

[Compute] Add Get-AzSharedVMExtensionVersion and Set-AzSharedVMExtensionVersionDeprecation - #30292

Open
Jayprakash gupta (Jaype-e) wants to merge 7 commits into
Azure:Az.Compute-privatefrom
Jaype-e:copilot/add-get-schedule-deprecation
Open

Jayprakash gupta (Jaype-e) wants to merge 7 commits into
Azure:Az.Compute-privatefrom
Jaype-e:copilot/add-get-schedule-deprecation

Conversation

@Jaype-e

@Jaype-e Jayprakash gupta (Jaype-e) commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

🤖 PR Validation — ️✔️ All clear

Tests
️✔️ 64/64

Description

Adds two new Az.Compute cmdlets for managing Shared VM Extension Version deprecation, plus build-break and business-logic fixes on top of the original work.

New cmdlets

  • Get-AzSharedVMExtensionVersion — GETs a shared VM extension version by resource group + name + version (or by -ResourceId).
  • Set-AzSharedVMExtensionVersionDeprecation — read-modify-write that sets the version's DeprecationStatus.

Fixes / changes in this PR

  • Resolved a CS0120 build break: fully-qualified Microsoft.Azure.Management.Compute.Models.DeprecationType.* in the [ValidateSet] attribute where the DeprecationType parameter name shadowed the static type.
  • Reworked Set-AzSharedVMExtensionVersionDeprecation to always build a fresh ExtensionDeprecationStatus from the supplied parameters (instead of merging the existing one), with per-state validation:
    • Active: -DaysUntilDeprecation / -DeprecationType are not allowed; status is cleared.
    • ScheduledForDeprecation: both -DaysUntilDeprecation and -DeprecationType are required; DeprecationTime = UtcNow + days.
    • Deprecated: -DeprecationType is required and -DaysUntilDeprecation is not allowed; the version is deprecated immediately (DeprecationTime = UtcNow).
  • Updated scenario tests and markdown help to match the new semantics.

Note: This PR was opened from a fork (Jaype-e/azure-powershell) because the branch could not be pushed to the upstream repository directly.

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Copilot AI and others added 5 commits September 10, 2026 04:03
Co-authored-by: audreyttt <225061541+audreyttt@users.noreply.github.com>
…tion

The -DeprecationType parameter property shadowed the same-named static
class Microsoft.Azure.Management.Compute.Models.DeprecationType, so the
ValidateSet attribute bound its arguments to the instance property,
producing CS0120 and breaking the Compute build (and all downstream
Analyze/Help/UX/Test jobs). Fully-qualify the type in ValidateSet.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…validation

Set-AzSharedVMExtensionVersionDeprecation now always builds a fresh
ExtensionDeprecationStatus from the supplied parameters instead of
merging the existing one, and enforces per-state rules:
- Active: -DaysUntilDeprecation/-DeprecationType not allowed; status cleared.
- ScheduledForDeprecation: both required; DeprecationTime = UtcNow + days.
- Deprecated: -DeprecationType required, -DaysUntilDeprecation not allowed;
  deprecated immediately (DeprecationTime = UtcNow).

Updates scenario tests and help accordingly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

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

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
Successfully started running 3 pipeline(s).

…zSharedVMExtensionVersionDeprecation

The cmdlet used this.IsParameterBound(...) without importing
Microsoft.WindowsAzure.Commands.Utilities.Common, which defines the
extension method. This broke the Compute.csproj build, causing the
built Az.Compute module to export no cmdlets and the StaticAnalysis
UX Metadata analyzer to report every cmdlet as 'not contained'.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
Successfully started running 3 pipeline(s).

The TestSharedVMExtensionVersionDeprecation scenario test runs in CI playback
mode and requires a committed SessionRecords JSON, which cannot be produced
without live Azure access against the 2026-03-03 preview API. This caused all
4 Test legs to fail with 'Unable to find recorded mock file'.

Replace it with deterministic unit tests that exercise every validation branch
of SetAzSharedVMExtensionVersionDeprecation.ComputeDeprecationStatus directly,
with no live calls. The SharedVMExtensionVersionTests.ps1 script is preserved
for future live recording.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
Successfully started running 3 pipeline(s).

@NoriZC NoriZC self-assigned this Oct 16, 2026
@@ -0,0 +1,205 @@
<#

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please record the newly added test cases.

@NoriZC NoriZC added needs-revision Request X Engineering Agent Ask the agent to triage this issue or review this PR labels Oct 16, 2026
@github-actions

Copy link
Copy Markdown

This PR was labeled "needs-revision" because it has unresolved review comments or CI failures.
Please resolve all open review comments and make sure all CI checks are green. Refer to our guide to troubleshoot common CI failures.

@x-engineering-agent

x-engineering-agent Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

X Engineering Agent Report

Review — Comments

Jayprakash gupta (@Jaype-e)

Upstream CI completed successfully on a0ec8f2, but the generated-ownership finding below remains actionable; passing CI does not supply the missing durable generation source.

Upstream CI

No failed upstream checks in this snapshot.

Test validation
  • Agent live test: Not run; this is a review-only PR. Check author-provided test evidence and upstream CI separately.
  • Regression coverage: Not applicable to the changed files.

The coverage helper is not applicable to these PowerShell files; that is not proof of scenario execution. src/Compute/Compute.Test/ScenarioTests/SharedVMExtensionVersionDeprecationTests.cs exercises the pure status helper, while SharedVMExtensionVersionTests.ps1:5 defines the live resource lifecycle. The changed C# class contains only direct helper assertions, with no scenario-runner invocation, and no session recording is included. Wire Test-SharedVMExtensionVersionDeprecation into the Compute scenario harness and provide its focused playback/live result before merge; that run must verify GET mapping, persisted schedule/reschedule, deprecated-to-active transitions and tag preservation. No Agent live test was run.

Repository policy findings
Risk assessment — 46/100 · Medium

The Medium rating is driven by public CLI behavior, failure-handling behavior, generated output.

  • Change scope: 12 changed files, 1139 changed lines (+1138 / -1), including 5 production files.
  • Affected components: compute
  • Risk drivers: public CLI behavior (+18); failure-handling behavior (+12); generated output (+12)
  • Regression evidence: Changed regression tests are included, reducing risk.
  • Confidence: High because changed-line patches were available for every production file.
  • Required review: Owning-squad review is recommended for compute before merge.

Posted by x-engineering-agent (Reviewer)

@x-engineering-agent x-engineering-agent Bot added the X Engineering Agent Reviewed Agent reviewed this PR label Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-revision Request X Engineering Agent Ask the agent to triage this issue or review this PR X Engineering Agent Reviewed Agent reviewed this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants