Skip to content

[ApiManagement] Add support for StandardV2 SKU in APIM Mappers.MapSku#29798

Draft
a0x1ab with Copilot wants to merge 7 commits into
mainfrom
copilot/fix-set-azapimanagement-standardv2-error
Draft

[ApiManagement] Add support for StandardV2 SKU in APIM Mappers.MapSku#29798
a0x1ab with Copilot wants to merge 7 commits into
mainfrom
copilot/fix-set-azapimanagement-standardv2-error

Conversation

Copilot AI commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Set-AzApiManagement fails when round-tripping an API Management service on the StandardV2 SKU because the ApiManagement SKU mapper rejects that value. This blocks common update flows that start with Get-AzApiManagement and then persist changes with Set-AzApiManagement.

  • Problem

    • Mappers.MapSku accepted existing APIM SKU values but not StandardV2
    • as a result, Set-AzApiManagement -InputObject $apim throws Unrecognized Sku 'StandardV2' before the request reaches the service
  • Code changes

    • added StandardV2 handling in Microsoft.Azure.Commands.ApiManagement.Helpers.Mappers.MapSku
    • introduced SkuType.StandardV2 in the SDK model constants so the new mapping follows the same pattern as the existing SKU cases
  • Coverage

    • added focused unit coverage for:
      • direct MapSku handling of StandardV2
      • MapPsApiManagement emitting StandardV2 in the outgoing SDK model used by Set-AzApiManagement
  • Release notes

    • added an ApiManagement changelog entry describing the StandardV2 update-path fix
$apim = Get-AzApiManagement -ResourceGroupName $rg -Name $name
$apim.ProxyCustomHostnameConfiguration = $newProxyConfigs
Set-AzApiManagement -InputObject $apim

With this change, the mapper preserves StandardV2 instead of rejecting it during the update flow.

Copilot AI requested review from Copilot and removed request for Copilot July 2, 2026 16:57
@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.

@a0x1ab

a0x1ab commented Jul 2, 2026

Copy link
Copy Markdown
Member

Live test skipped

⏭️ Skipping the live test for this revision because no changed test file was found under a <Service>.Test project (src/<Service>/<Service>.Test/**/*.cs|*.ps1).

The live-test pipeline runs only the scenario/xUnit test files a PR changes, so there is nothing to execute for this commit. This is informational — a regression test is encouraged where it makes sense, but not required. If a test file is added in a later commit, the live test will run automatically.


Posted by agent-assist (autonomous bug-fix pipeline).

Copilot AI requested review from Copilot and removed request for Copilot July 2, 2026 17:03
Copilot AI requested review from Copilot and removed request for Copilot July 2, 2026 17:03
Copilot AI changed the title [WIP] Fix Set-AzApiManagement failure on APIM StandardV2 [ApiManagement] Add support for StandardV2 SKU in APIM Mappers.MapSku Jul 2, 2026
Copilot AI requested a review from a0x1ab July 2, 2026 17:04
Copilot finished work on behalf of a0x1ab July 2, 2026 17:04
@a0x1ab

a0x1ab commented Jul 2, 2026

Copy link
Copy Markdown
Member

@copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #29798 (review) and push a fix.


Posted by agent-assist (autonomous bug-fix pipeline).

@a0x1ab a0x1ab left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Automated Review — Failures Found

This PR currently has failing checks that need to be addressed:

  1. Live test (TestFx Record) — the dispatched live-test run failed.
    Run: https://github.com/Azure/issue-sentinel/actions/runs/28607831895

  2. CI check azure-powershell - powershell-core (Test linux) — failed.
    Run: https://github.com/Azure/azure-powershell/runs/84835896240

Please investigate why the ApiManagement Mappers.MapSku changes for the
StandardV2 SKU are failing the Linux PowerShell Core test run and the record
live test, fix the underlying issue, and push an update. Make sure to:

  • Re-run/record the affected ApiManagement.Test scenarios with the new SKU
    handling included.
  • Confirm the ChangeLog.md entry under src/ApiManagement/ApiManagement/
    reflects the fix.

Once pushed, this PR will be automatically re-tested.


Posted by agent-assist (autonomous bug-fix pipeline).

Copilot AI requested review from Copilot and removed request for Copilot July 2, 2026 17:28

Copilot AI commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

@copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #29798 (review)...

Addressed in 77b9cb35b. The repo-side CI failure was the ApiManagement test project missing a reference to ApiManagement.csproj, so the new unit tests could not compile during the test phase. I added that project reference. The live-test failure appears to be in the external issue-sentinel workflow (gh api rejected its classic PAT with HTTP 403), not in the ApiManagement code changed here.

Copilot AI requested a review from a0x1ab July 2, 2026 17:29
Copilot finished work on behalf of a0x1ab July 2, 2026 17:29

@a0x1ab a0x1ab left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Review Summary — PR #29798 fails CI and live test

This PR ([ApiManagement] Add support for StandardV2 SKU in APIM Mappers.MapSku) currently has failing checks and a failing live test. Please investigate and fix:

CI failures

Live test (TestFx Record)

Please:

  1. Check the build output for compile errors introduced by the StandardV2 SKU mapping change in Mappers.MapSku.
  2. Fix the Analyze (style/lint) failures reported for both the Windows PowerShell and PowerShell Core builds.
  3. Re-run/update the affected <Service>.Test live test(s) so they pass after the fix.
  4. Ensure the ChangeLog.md entry under src/ApiManagement/ApiManagement/ is updated if required by the PR template.

Once pushed, this PR will be re-evaluated automatically.


Posted by agent-assist (autonomous bug-fix pipeline).

@a0x1ab

a0x1ab commented Jul 2, 2026

Copy link
Copy Markdown
Member

@copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #29798 (review) and push a fix.


Posted by agent-assist (autonomous bug-fix pipeline).

Copilot AI requested review from Copilot and removed request for Copilot July 2, 2026 18:05
Copilot AI requested review from Copilot and removed request for Copilot July 2, 2026 18:06
Copilot AI requested review from Copilot and removed request for Copilot July 2, 2026 18:07

Copilot AI commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

@copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #29798 (review)...

Addressed in 236ef131d. The Analyze failures were caused by the earlier edit under ApiManagement.Management.Sdk/Generated, which trips the generated-SDK validation. I moved the StandardV2 handling into handwritten ApiManagement code/tests, restored the generated file, and kept the ApiManagement ChangeLog.md entry. The live-test run linked in the review failed before test selection because the external issue-sentinel workflow hit a PAT 403 while resolving the PR head, so it did not surface an ApiManagement test failure in that run.

Copilot finished work on behalf of a0x1ab July 2, 2026 18:07
Copilot AI requested a review from a0x1ab July 2, 2026 18:07

@a0x1ab a0x1ab left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Automated review — PR #29798

CI status: ✅ All 11 checks passed, 0 failed, 0 pending.

Live test (TestFx Record): The issue-sentinel dispatcher recorded this run
as failure, but that is an infrastructure issue in the issue-sentinel
workflow itself
, not a problem with this PR's code:

gh: The 'Microsoft Open Source' enterprise forbids access via a personal
access tokens (classic) if the token's lifetime is greater than 8 days.
(HTTP 403)

The workflow failed while trying to fetch PR metadata (gh api repos/Azure/azure-powershell/pulls/29798) using an expired/non-compliant
classic PAT, before it could even determine which test files changed. The
workflow's own scope-limiting logic (visible later in the same job) resolved
to No changed test files — skipping live test (neutral), confirming this PR
does not touch a <Service>.Test project and the live test would have been a
no-op regardless.

Conclusion: No action needed from Copilot on this PR — CI is green and the
live-test failure is unrelated to the PR's content (a token-policy problem on
the Azure/issue-sentinel side). Flagging this separately so the tester
infra can be fixed independently.


Posted by agent-assist (autonomous bug-fix pipeline).

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.

Set-AzApiManagement fails on APIM StandardV2 with Unrecognized Sku 'StandardV2'

2 participants