Fix inverted SkuCapacity validation for CapacityReservation SKU in OperationalInsights - #30112
Fix inverted SkuCapacity validation for CapacityReservation SKU in OperationalInsights#30112Aditya Pujara (a0x1ab) with Copilot wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
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: 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>
There was a problem hiding this comment.
🟡 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` |
|
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) |
There was a problem hiding this comment.
Copilot this check is also broken - capacity should be bigger or equal to 100
Live test results — TestFx
|
There was a problem hiding this comment.
Test validation
-
Live test: Failed (build error). The
live-test-powershell.ymljob 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.Testactually references theOperationalInsightsproject (or the
correct assembly) and that the reference is included in the project file used by this build
configuration. - Confirm
PSWorkspaceSkuand its constructor used by the test
(new PSWorkspaceSku("CapacityReservation", 1000)) arepublic, notinternal, or add
InternalsVisibleTofor the test assembly if internal visibility is intended. - After fixing the reference/visibility, rerun the focused
live-test-powershell.ymldispatch
(TestFxRecord) scoped toOperationalInsights.Testto confirm the build and the five new
PSWorkspaceSkuTestsfacts 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.
|
Started a Copilot task using |
There was a problem hiding this comment.
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-sentinel → Live 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.
🤖 PR Validation —⚠️ Review suggested
️✔️Az.Accounts
️✔️Az.ApplicationInsights
️✔️Az.Compute
️✔️Az.EventHub
️✔️Az.HDInsight
️✔️Az.KeyVault
️✔️Az.ManagedServiceIdentity
️✔️Az.Monitor
️✔️Az.Network
️✔️Az.PrivateDns
️✔️Az.Security
️✔️Az.Sql
️✔️Az.Storage
New-AzOperationalInsightsWorkspace/Set-AzOperationalInsightsWorkspacerejectedSkuCapacitywhenSkuwasCapacityReservation— the only tier that actually supports it — due to an inverted condition inPSWorkspaceSku.ValidateSKU().Root cause
(this.Capacity != null || this.Capacity != 0) && serviceTrier.Equals(CapacityReservation)always evaluated totruefor non-null capacity and threw for theCapacityReservationtier itself, instead of the other tiers.Fix
src/OperationalInsights/OperationalInsights/Models/PSWorkspaceSku.cs: corrected the guard tothis.Capacity != null && !serviceTrier.Equals(CapacityReservation), so capacity is now accepted forCapacityReservationand rejected for all other tiers.Tests
PSWorkspaceSkuTestsunit tests covering capacity acceptance forCapacityReservation, rejection for other tiers, no-capacity creation, and the existing minimum/multiple-of-100 capacity checks.Changelog
src/OperationalInsights/OperationalInsights/ChangeLog.md.