Skip to content

Fix inverted SkuCapacity validation for CapacityReservation SKU in OperationalInsights - #30112

Open
Aditya Pujara (a0x1ab) with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-capacityreservation-parameter-issue
Open

Fix inverted SkuCapacity validation for CapacityReservation SKU in OperationalInsights#30112
Aditya Pujara (a0x1ab) with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-capacityreservation-parameter-issue

Conversation

Copilot AI commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🤖 PR Validation — ⚠️ Review suggested

Tests
⚠️ 68/68
️✔️Az.Accounts
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.ApplicationInsights
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.Compute
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.EventHub
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.HDInsight
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Test
️✔️PowerShell Core - Linux
️✔️PowerShell Core - MacOS
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.KeyVault
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.ManagedServiceIdentity
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.Monitor
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Test
️✔️PowerShell Core - Linux
️✔️PowerShell Core - MacOS
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.Network
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Test
️✔️PowerShell Core - Linux
️✔️PowerShell Core - MacOS
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
⚠️Az.OperationalInsights
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Breaking Change Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Signature Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Help File Existence Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️File Change Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️UX Metadata Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
⚠️Test
⚠️PowerShell Core - Linux
Type Title Current Coverage Description
⚠️ Test Coverage Less Than 50% 0.00 % Test coverage for the module cannot be lower than 50%.
⚠️PowerShell Core - MacOS
Type Title Current Coverage Description
⚠️ Test Coverage Less Than 50% 0.00% Test coverage for the module cannot be lower than 50%.
⚠️PowerShell Core - Windows
Type Title Current Coverage Description
⚠️ Test Coverage Less Than 50% 0.00% Test coverage for the module cannot be lower than 50%.
⚠️Windows PowerShell - Windows
Type Title Current Coverage Description
⚠️ Test Coverage Less Than 50% 0.00% Test coverage for the module cannot be lower than 50%.
️✔️Az.PrivateDns
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.Security
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Test
️✔️PowerShell Core - Linux
️✔️PowerShell Core - MacOS
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.Sql
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Test
️✔️PowerShell Core - Linux
️✔️PowerShell Core - MacOS
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.Storage
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
⚠️Az.Synapse
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
⚠️Test
⚠️PowerShell Core - Linux
Type Title Current Coverage Description
⚠️ Test Coverage Less Than 50% 46.89 % Test coverage for the module cannot be lower than 50%.
⚠️PowerShell Core - MacOS
Type Title Current Coverage Description
⚠️ Test Coverage Less Than 50% 46.89% Test coverage for the module cannot be lower than 50%.
⚠️PowerShell Core - Windows
Type Title Current Coverage Description
⚠️ Test Coverage Less Than 50% 46.89% Test coverage for the module cannot be lower than 50%.
⚠️Windows PowerShell - Windows
Type Title Current Coverage Description
⚠️ Test Coverage Less Than 50% 46.89% Test coverage for the module cannot be lower than 50%.

New-AzOperationalInsightsWorkspace/Set-AzOperationalInsightsWorkspace rejected SkuCapacity when Sku was CapacityReservation — the only tier that actually supports it — due to an inverted condition in PSWorkspaceSku.ValidateSKU().

New-AzOperationalInsightsWorkspace -ResourceGroupName testrg -Location "East US" `
    -Sku "CapacityReservation" -Name "test-law" -SkuCapacity 100
# Failed to set Capacity for SKU: CapacityReservation, Capacity is only supported for CapacityReservation SKU

Root cause

  • (this.Capacity != null || this.Capacity != 0) && serviceTrier.Equals(CapacityReservation) always evaluated to true for non-null capacity and threw for the CapacityReservation tier itself, instead of the other tiers.

Fix

  • src/OperationalInsights/OperationalInsights/Models/PSWorkspaceSku.cs: corrected the guard to this.Capacity != null && !serviceTrier.Equals(CapacityReservation), so capacity is now accepted for CapacityReservation and rejected for all other tiers.

Tests

  • Added PSWorkspaceSkuTests unit tests covering capacity acceptance for CapacityReservation, rejection for other tiers, no-capacity creation, and the existing minimum/multiple-of-100 capacity checks.

Changelog

  • Added an entry under "Upcoming Release" in src/OperationalInsights/OperationalInsights/ChangeLog.md.

Copilot AI lite review requested due to automatic review settings September 4, 2026 19:40

Copilot AI left a comment

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.

Copilot wasn't able to review any files in this pull request.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
Successfully started running 2 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 4, 2026 19:45
Copilot AI changed the title [WIP] Fix issue with CapacityReservation SKU and SkuCapacity parameter Fix inverted SkuCapacity validation for CapacityReservation SKU in OperationalInsights Sep 4, 2026

Copilot AI left a comment

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.

🟡 Changes recommended

The new changelog entry should include the referenced GitHub issue number so the release note is properly traceable.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

-->

## Upcoming Release
* Fixed an issue where `New-AzOperationalInsightsWorkspace` and `Set-AzOperationalInsightsWorkspace` incorrectly rejected the `SkuCapacity` parameter when `Sku` was set to `CapacityReservation`
@x-engineering-agent
x-engineering-agent Bot marked this pull request as ready for review September 4, 2026 19:52
@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
Successfully started running 2 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

throw new PSArgumentException($"Failed to set Capacity for SKU: {serviceTrier}, Capacity is only supported for {AllowedWorkspaceServiceTiers.CapacityReservation} SKU");
}

if (this.Capacity != null && this.Capacity < 1000)

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 this check is also broken - capacity should be bigger or equal to 100

@x-engineering-agent

Copy link
Copy Markdown

Live test results — TestFx Record (changed test files only)

FAIL (exit )

Test projects: src/OperationalInsights/OperationalInsights.Test
Filter: FullyQualifiedName~PSWorkspaceSkuTests
PR head ref: copilot/fix-capacityreservation-parameter-issue
PR head sha: b5563a4556f4d8fd9f708b2636f5179d82283fd8
PR base ref: main

Changed test files run
src/OperationalInsights/OperationalInsights.Test/UnitTests/PSWorkspaceSkuTests.cs

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/33914315865

Last 80 lines of dotnet test output
(no log captured)

Posted by the Azure Client Tools Agent PowerShell live-test workflow.

@x-engineering-agent x-engineering-agent Bot added the Request X Engineering Agent Request X Engineering Agent testing and review label Sep 4, 2026

@x-engineering-agent x-engineering-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Test validation

  • Live test: Failed (build error). The live-test-powershell.yml job TestFx Record (PR 30112) failed at the Build changed test project(s) step with:

    error CS0234: The type or namespace name 'Models' does not exist in the namespace
    'Microsoft.Azure.Commands.OperationalInsights' (are you missing an assembly reference?)
    

    This is emitted twice, both pointing at the new
    src/OperationalInsights/OperationalInsights.Test/UnitTests/PSWorkspaceSkuTests.cs, which does
    using Microsoft.Azure.Commands.OperationalInsights.Models; and directly constructs
    new PSWorkspaceSku(...). The build cannot resolve that namespace from the test project, so the
    change never actually compiles/runs. Workflow run

  • Regression coverage: Not applicable to the changed files (no automated coverage helper for this repository).

Next action

Fix the test project so it can see Microsoft.Azure.Commands.OperationalInsights.Models.PSWorkspaceSku:

  • Confirm OperationalInsights.Test actually references the OperationalInsights project (or the
    correct assembly) and that the reference is included in the project file used by this build
    configuration.
  • Confirm PSWorkspaceSku and its constructor used by the test
    (new PSWorkspaceSku("CapacityReservation", 1000)) are public, not internal, or add
    InternalsVisibleTo for the test assembly if internal visibility is intended.
  • After fixing the reference/visibility, rerun the focused live-test-powershell.yml dispatch
    (TestFx Record) scoped to OperationalInsights.Test to confirm the build and the five new
    PSWorkspaceSkuTests facts pass.

Risk assessment

0/100 · Low · High confidence

The Low rating reflects the detected change scope with no elevated security, reliability, customer, operational, dependency, sovereign-cloud, generated-output, or cross-component signal.

  • Change scope: 3 changed files, 68 changed lines (+67 / -1), including 1 production file.
  • Affected components: operationalinsights
  • Risk drivers: No elevated risk signal was detected.
  • Regression evidence: Changed regression tests are included, reducing risk.
  • Confidence: High because changed-line patches were available for every production file.
  • Required review: No additional owning-squad review signal was detected.

@x-engineering-agent x-engineering-agent Bot added the X Engineering Agent Reviewed Pull request reviewed by X Engineering Agent label Sep 4, 2026
@x-engineering-agent

Copy link
Copy Markdown

Started a Copilot task using claude-sonnet-4.6 for the automated review at #30112 (review): https://github.com/Azure/azure-powershell/tasks/bf2b8fcf-0cf7-409c-b378-f6d78c3744bc

@x-engineering-agent x-engineering-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Test validation

  • Live test: Failed with conclusion failure.
  • Regression coverage: Not applicable to the changed files.

Risk assessment

0/100 · Low · High confidence

The Low rating reflects the detected change scope with no elevated security, reliability, customer, operational, dependency, sovereign-cloud, generated-output, or cross-component signal.

  • Change scope: 3 changed files, 68 changed lines (+67 / -1), including 1 production file.
  • Affected components: operationalinsights
  • Risk drivers: No elevated risk signal was detected.
  • Regression evidence: Changed regression tests are included, reducing risk.
  • Confidence: High because changed-line patches were available for every production file.
  • Required review: No additional owning-squad review signal was detected.

Live test failure classification — uncertain

Upstream CI (all 15 checks, including build/tests) passed. Only the TestFx Record live test run
(Azure/issue-sentinel run 33914315865,
job TestFx Record (PR 30112)) failed at the "Build changed test project(s)" step with:

The type or namespace name 'Models' does not exist in the namespace
'Microsoft.Azure.Commands.OperationalInsights' (are you missing an assembly reference?)

The new test file PSWorkspaceSkuTests.cs uses
using Microsoft.Azure.Commands.OperationalInsights.Models;, which matches the actual namespace
of PSWorkspaceSku.cs (verified against the PR head). The full solution build in upstream CI
succeeded, so this looks like the live-test workflow's scoped "changed test project(s) only" build
not resolving the main OperationalInsights project reference, rather than a defect in this PR's
source. I can't confirm this from the job logs alone (raw logs were not retrievable), so I'm
marking it uncertain rather than blocking.

Next action: no source change is requested from this classification. Please re-run the live
test workflow (Azure/issue-sentinelLive Test (Azure PowerShell PR) for PR 30112) to confirm
whether the build failure reproduces; if it reproduces, escalate to whoever owns the live-test
workflow's changed-project build scoping, since the same file builds cleanly as part of the full
OperationalInsights project in upstream CI.

@x-engineering-agent x-engineering-agent Bot removed the Request X Engineering Agent Request X Engineering Agent testing and review label Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

X Engineering Agent Reviewed Pull request reviewed by X Engineering Agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to set CapacityReservation SKU and SkuCapacity parameter for Operational Insights Workspace

4 participants