Skip to content

[Network] Fix #33981: az network application-gateway show: Bump parent Application Gateway API version to 2025-07-01 so Managed HSM SSL certificate fields are preserved - #34040

Open
Aditya Pujara (a0x1ab) wants to merge 2 commits into
Azure:devfrom
a0x1ab:agent-assist/azure-azure-cli-issue-33981-ef9e71dface1

Conversation

@a0x1ab

Copy link
Copy Markdown
Member

Description

Fixes #33981.

Related command
az network application-gateway show / az network application-gateway create / az network application-gateway update

Description

The parent application_gateway AAZ operations (show, create, update) were using API version 2024-10-01, while the ssl_cert sub-group already used 2025-07-01. This mismatch caused sslCertificates[].properties.hsm.keyId and hsm.publicCertData (Managed HSM–backed certificate fields, introduced in 2025-07-01) to be silently dropped on any GET or PUT round-trip through the parent resource.

  • _show.py / _create.py / _update.py: Bumped _aaz_info["version"], the resources entry, and all api-version query parameters from 2024-10-012025-07-01.
  • Response schema (_show.py, _create.py, _update.py): Added sslCertificates[].properties.hsm (AAZObjectType) with hsm.key_id (keyId) and hsm.public_cert_data (publicCertData) to match the schema already present in the ssl_cert sub-group.

Testing Guide

New unit tests in test_network_unit_tests.py:

  • test_application_gateway_parent_api_version — asserts all three operations declare 2025-07-01 in _aaz_info and resources.
  • test_application_gateway_show_ssl_cert_hsm_schema — introspects the built ApplicationGatewaysGet response schema at runtime, asserting hsm, key_id, and public_cert_data are present under ssl_certificates.Element.properties.

History Notes

[Network] az network application-gateway show: Bump API version to 2025-07-01 so Managed HSM SSL certificate fields (hsm.keyId / hsm.publicCertData) are preserved on show/create/update

Generation source

Azure/aaz#1071

Generation source

Azure/aaz#1071

…p parent Application Gateway API version to 2025-07-01 so Managed HSM SSL certificate fields are preserved

* Initial plan

* Bump Application Gateway API version to 2025-07-01 and add Managed HSM SSL certificate fields

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

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>

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.

🟢 Approval recommended

The API-version bump is consistently applied across the targeted parent operations and the schema/tests align with the existing ssl_cert subgroup’s HSM field definitions.

Pull request overview

This PR fixes an API-version mismatch in the Application Gateway parent AAZ operations so Managed HSM–backed SSL certificate properties (sslCertificates[].properties.hsm.keyId / publicCertData) are not lost during show/create/update round-trips.

Changes:

  • Bumps az network application-gateway parent show/create/update AAZ operations from 2024-10-01 to 2025-07-01 (including _aaz_info and api-version query params).
  • Extends the parent operations’ response schema to include sslCertificates[].properties.hsm.{key_id, public_cert_data} to match the existing ssl_cert subgroup shape.
  • Adds unit tests asserting the parent operations’ API version and validating the show response schema includes the HSM fields.
File summaries
File Description
src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_unit_tests.py Adds unit tests to assert parent Application Gateway ops use 2025-07-01 and that show schema includes sslCertificates[].properties.hsm.
src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/_show.py Bumps API version to 2025-07-01 and adds HSM fields to the show response schema.
src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/_create.py Bumps API version to 2025-07-01 and adds HSM fields to the create response schema.
src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/_update.py Bumps API version to 2025-07-01 for GET/PUT and adds HSM fields to the shared read schema used by update’s instance round-trip.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

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

@x-engineering-agent x-engineering-agent Bot added the Request X Engineering Agent Request X Engineering Agent testing and review label Sep 7, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

🔔 Routing this PR to @Azure/act-quality-productivity-squad.

@yonzhan

Copy link
Copy Markdown
Collaborator

Network

@x-engineering-agent

Copy link
Copy Markdown
Contributor

Live test results — azdev test --live --series (changed test files only)

PASS

Selectors: test_network_unit_tests (module)
PR head ref: agent-assist/azure-azure-cli-issue-33981-ef9e71dface1
PR head sha: 6dd2eaa6a12177f8ec3ec4c4192c9d91e05f583b
PR base ref: dev
New test files in PR: false

Changed test files run
src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_unit_tests.py

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

Last 80 lines of azdev output

=============
| Run Tests |
=============


=====================
| Discovering Tests |
=====================

/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:13705: SyntaxWarning: invalid escape sequence '\]'
  self.cmd('vmss application set -g {rg} -n {vmss} --app-version-ids {vid1} {vid2} --enable-automatic-upgrade True\]', checks=[
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/identity/tests/latest/test_identity.py:18: SyntaxWarning: invalid escape sequence '\{'
  'resource_restriction_compute': '\{"providers":\["Microsoft.Compute"\]\}',
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/identity/tests/latest/test_identity.py:19: SyntaxWarning: invalid escape sequence '\{'
  'resource_restriction_empty': '\{"providers":\[\]\}'

test index updated: /home/runner/.azdev/env_config/home/runner/work/issue-sentinel/issue-sentinel/.venv/test_index/latest.json

Test on modules: test_network_unit_tests

WARNING: RUNNING TESTS LIVE
The tests are set to run against current profile "latest"
============================= test session starts ==============================
platform linux -- Python 3.12.14, pytest-9.1.1, pluggy-1.6.0 -- /home/runner/work/issue-sentinel/issue-sentinel/.venv/bin/python
cachedir: .pytest_cache
rootdir: /home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli
plugins: forked-1.7.5, xdist-3.8.0
collecting ... collected 6 items

azure-cli/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_unit_tests.py::TestNetworkUnitTests::test_network_get_nic_ip_config PASSED [ 16%]
azure-cli/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_unit_tests.py::TestNetworkUnitTests::test_network_upsert PASSED [ 33%]
azure-cli/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_unit_tests.py::TestVpnConnectionCertAuthNoSharedKey::test_application_gateway_parent_api_version PASSED [ 50%]
azure-cli/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_unit_tests.py::TestVpnConnectionCertAuthNoSharedKey::test_application_gateway_show_ssl_cert_hsm_schema PASSED [ 66%]
azure-cli/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_unit_tests.py::TestVpnConnectionCertAuthNoSharedKey::test_cert_auth_without_shared_key_should_not_raise PASSED [ 83%]
azure-cli/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_unit_tests.py::TestVpnConnectionCertAuthNoSharedKey::test_no_shared_key_without_cert_auth_should_raise PASSED [100%]

- generated xml file: /home/runner/work/issue-sentinel/issue-sentinel/test-output/results.xml -
============================== 6 passed in 4.53s ===============================

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

@x-engineering-agent x-engineering-agent Bot 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.

Aditya Pujara (@a0x1ab)

Upstream CI

One Azure DevOps build group failed (build 342054), covering 4 job instances, all with the same root cause:

  • Automation Full Test Python314/Python312 Profile Latest, instances 1 and 7CannotOverwriteExistingCassetteException: recorded VCR cassettes no longer match live requests because they still reference the pre-change api-version.
    • test_appgw_private_endpoint_with_overwrite_default (network) — no match for GET .../applicationGateways/appgw?api-version=2025-07-01.
    • test_metric_alert_special_char_scenario (monitor) — no match for GET .../applicationGateways/ag1?api-version=2025-07-01.

Test validation

  • Live test: Passed.
  • Regression coverage: Present for network: 1 focused test file changed (new unit tests assert the 2025-07-01 version and the hsm schema fields), but this only covers application_gateway/_show.py, _create.py, _update.py in isolation.

Confirmed finding — stale VCR cassettes after the API-version bump (PR-related)

_show.py, _create.py, _update.py bump every parent application_gateway operation's api-version query parameter from 2024-10-01 to 2025-07-01. Existing recorded cassettes for other network/monitor scenarios that exercise application_gateway GET/PUT (e.g. test_appgw_private_endpoint_with_overwrite_default.yaml, and the monitor test_metric_alert_special_char_scenario.yaml recording, which nests an applicationGateways call) were not re-recorded to the new api-version, so live-mode VCR playback now finds "no match for request" and raises CannotOverwriteExistingCassetteException.

  • Remediation: Re-record (or hand-patch the api-version query string in) the affected cassette YAML files so they reflect api-version=2025-07-01 for every applicationGateways request, then rerun the specific failing tests (test_appgw_private_endpoint_with_overwrite_default, test_metric_alert_special_char_scenario) to confirm they pass in RecordMode.ONCE without needing network access.
  • Verification: Rerun the failed Azure DevOps job (Automation Full Test Python312/Python314 Profile Latest, instances 1 and 7) and confirm the CannotOverwriteExistingCassetteException no longer appears.

Risk assessment

56/100 · High · High confidence

The High rating is driven by security-sensitive behavior, public CLI behavior, generated output.

  • Change scope: 4 changed files, 93 changed lines (+83 / -10), including 3 production files.
  • Affected components: network
  • Risk drivers: security-sensitive behavior (+28); public CLI behavior (+18); 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 required for network before merge.

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

Copy link
Copy Markdown
Contributor

Started a Copilot task using claude-sonnet-4.6 for the automated review at #34040 (review): https://github.com/a0x1ab/azure-cli/tasks/0d858fe5-331a-485b-af2d-e5c87a5c8a98

Agent memory used

X Engineering Agent retrieved the following memory learned only from public GitHub feedback. Raw memory and internal provenance are not included.

  • Memory mem-940b2982d86c7103fda7 (core) was retrieved to guide the implementation work. Evidence: feedback 1, feedback 2, feedback 3, feedback 4, feedback 5, feedback 6

  • Memory mem-bcd8e3ff17cdfb8e4bf0 (decaying) was retrieved to guide the implementation work. Evidence: feedback 1

  • Memory mem-ed138128511782d6d361 (decaying) was retrieved to guide the implementation work. Evidence: feedback 1, feedback 2

  • Memory mem-ef2d72751394073a2281 (decaying) was retrieved to guide the implementation work. Evidence: feedback 1

@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

🔔 Routing this PR to @Azure/act-quality-productivity-squad.

…p parent Application Gateway API version to 2025-07-01 so Managed HSM SSL certificate fields are preserved

* Initial plan

* Bump Application Gateway API version to 2025-07-01 and add Managed HSM SSL certificate fields

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

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
@a0x1ab
Aditya Pujara (a0x1ab) requested a review from a team as a code owner September 7, 2026 07:36
@x-engineering-agent

Copy link
Copy Markdown
Contributor

Live test results — azdev test --live --series (changed test files only)

PASS

Selectors: test_network_unit_tests (module)
PR head ref: agent-assist/azure-azure-cli-issue-33981-ef9e71dface1
PR head sha: 5993daddd9d26894a9be9341e9edaaabc41c0436
PR base ref: dev
New test files in PR: false

Changed test files run
src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_unit_tests.py

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

Last 80 lines of azdev output

=============
| Run Tests |
=============


=====================
| Discovering Tests |
=====================

/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:13705: SyntaxWarning: invalid escape sequence '\]'
  self.cmd('vmss application set -g {rg} -n {vmss} --app-version-ids {vid1} {vid2} --enable-automatic-upgrade True\]', checks=[
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/identity/tests/latest/test_identity.py:18: SyntaxWarning: invalid escape sequence '\{'
  'resource_restriction_compute': '\{"providers":\["Microsoft.Compute"\]\}',
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/identity/tests/latest/test_identity.py:19: SyntaxWarning: invalid escape sequence '\{'
  'resource_restriction_empty': '\{"providers":\[\]\}'

test index updated: /home/runner/.azdev/env_config/home/runner/work/issue-sentinel/issue-sentinel/.venv/test_index/latest.json

Test on modules: test_network_unit_tests

WARNING: RUNNING TESTS LIVE
The tests are set to run against current profile "latest"
============================= test session starts ==============================
platform linux -- Python 3.12.14, pytest-9.1.1, pluggy-1.6.0 -- /home/runner/work/issue-sentinel/issue-sentinel/.venv/bin/python
cachedir: .pytest_cache
rootdir: /home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli
plugins: forked-1.7.5, xdist-3.8.0
collecting ... collected 6 items

azure-cli/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_unit_tests.py::TestNetworkUnitTests::test_network_get_nic_ip_config PASSED [ 16%]
azure-cli/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_unit_tests.py::TestNetworkUnitTests::test_network_upsert PASSED [ 33%]
azure-cli/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_unit_tests.py::TestVpnConnectionCertAuthNoSharedKey::test_application_gateway_parent_api_version PASSED [ 50%]
azure-cli/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_unit_tests.py::TestVpnConnectionCertAuthNoSharedKey::test_application_gateway_show_ssl_cert_hsm_schema PASSED [ 66%]
azure-cli/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_unit_tests.py::TestVpnConnectionCertAuthNoSharedKey::test_cert_auth_without_shared_key_should_not_raise PASSED [ 83%]
azure-cli/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_unit_tests.py::TestVpnConnectionCertAuthNoSharedKey::test_no_shared_key_without_cert_auth_should_raise PASSED [100%]

- generated xml file: /home/runner/work/issue-sentinel/issue-sentinel/test-output/results.xml -
============================== 6 passed in 3.16s ===============================

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

@x-engineering-agent x-engineering-agent Bot 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.

Aditya Pujara (@a0x1ab)

Review summary

All gates pass for this change.

  • Live test (Tester): completed, conclusion success (azdev test on the changed network test files).
  • Upstream CI: 4/4 checks completed, 0 failed, 0 pending.
  • Regression coverage: production changes in network/aaz/latest/network/application_gateway/{_create,_show,_update}.py are covered by a modified recording (test_appgw_private_endpoint_with_overwrite_default.yaml) and new unit tests (test_application_gateway_parent_api_version, test_application_gateway_show_ssl_cert_hsm_schema) — no coverage gap.
  • Generation source: the AAZ api-version bump and new sslCertificates[].properties.hsm schema fields are backed by the open durable source PR Azure/aaz#1071 ("register API versions 2024-10-01 → 2025-07-01 in tree.json"), so the generated _create.py/_show.py/_update.py output is reproducible from a tracked source rather than a hand edit.
  • History Notes: present in the PR description with customer-visible wording, satisfying the release-artifact check.
  • Review-skill findings: none confirmed.

Risk assessment

57/100 · High · High confidence

The High rating is driven by security-sensitive behavior, public CLI behavior, generated output.

  • Change scope: 6 changed files, 97 changed lines (+85 / -12), including 3 production files.
  • Affected components: network
  • Risk drivers: security-sensitive behavior (+28); public CLI behavior (+18); 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 required for network before merge.

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

Labels

act-quality-productivity-squad Auto-Assign Auto assign by bot Network az network vnet/lb/nic/dns/etc... X Engineering Agent Reviewed Pull request reviewed by X Engineering Agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The latest Azure CLI release (2.89.1) still generates the parent Application Gateway GET command with API version 2024-10-01

5 participants