diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/_create.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/_create.py index 02fc5f8926b..cf08f7cd8e5 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/_create.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/_create.py @@ -16,9 +16,9 @@ class Create(AAZCommand): """ _aaz_info = { - "version": "2024-10-01", + "version": "2025-07-01", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/applicationgateways/{}", "2024-10-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/applicationgateways/{}", "2025-07-01"], ] } @@ -1651,7 +1651,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-10-01", + "api-version", "2025-07-01", required=True, ), } @@ -3268,6 +3268,7 @@ def _build_schema_on_200_201(cls): properties = cls._schema_on_200_201.properties.ssl_certificates.Element.properties properties.data = AAZStrType() + properties.hsm = AAZObjectType() properties.key_vault_secret_id = AAZStrType( serialized_name="keyVaultSecretId", ) @@ -3281,6 +3282,14 @@ def _build_schema_on_200_201(cls): flags={"read_only": True}, ) + hsm = cls._schema_on_200_201.properties.ssl_certificates.Element.properties.hsm + hsm.key_id = AAZStrType( + serialized_name="keyId", + ) + hsm.public_cert_data = AAZStrType( + serialized_name="publicCertData", + ) + ssl_profiles = cls._schema_on_200_201.properties.ssl_profiles ssl_profiles.Element = AAZObjectType() diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/_show.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/_show.py index 836f2cf6444..2888955d605 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/_show.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/_show.py @@ -19,9 +19,9 @@ class Show(AAZCommand): """ _aaz_info = { - "version": "2024-10-01", + "version": "2025-07-01", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/applicationgateways/{}", "2024-10-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/applicationgateways/{}", "2025-07-01"], ] } @@ -117,7 +117,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-10-01", + "api-version", "2025-07-01", required=True, ), } @@ -1062,6 +1062,7 @@ def _build_schema_on_200(cls): properties = cls._schema_on_200.properties.ssl_certificates.Element.properties properties.data = AAZStrType() + properties.hsm = AAZObjectType() properties.key_vault_secret_id = AAZStrType( serialized_name="keyVaultSecretId", ) @@ -1075,6 +1076,14 @@ def _build_schema_on_200(cls): flags={"read_only": True}, ) + hsm = cls._schema_on_200.properties.ssl_certificates.Element.properties.hsm + hsm.key_id = AAZStrType( + serialized_name="keyId", + ) + hsm.public_cert_data = AAZStrType( + serialized_name="publicCertData", + ) + ssl_profiles = cls._schema_on_200.properties.ssl_profiles ssl_profiles.Element = AAZObjectType() diff --git a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/_update.py b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/_update.py index 872b780a725..329ff49708b 100644 --- a/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/_update.py +++ b/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/application_gateway/_update.py @@ -19,9 +19,9 @@ class Update(AAZCommand): """ _aaz_info = { - "version": "2024-10-01", + "version": "2025-07-01", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/applicationgateways/{}", "2024-10-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/applicationgateways/{}", "2025-07-01"], ] } @@ -452,7 +452,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-10-01", + "api-version", "2025-07-01", required=True, ), } @@ -551,7 +551,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-10-01", + "api-version", "2025-07-01", required=True, ), } @@ -1864,6 +1864,7 @@ def _build_schema_application_gateway_read(cls, _schema): properties = _schema_application_gateway_read.properties.ssl_certificates.Element.properties properties.data = AAZStrType() + properties.hsm = AAZObjectType() properties.key_vault_secret_id = AAZStrType( serialized_name="keyVaultSecretId", ) @@ -1877,6 +1878,14 @@ def _build_schema_application_gateway_read(cls, _schema): flags={"read_only": True}, ) + hsm = _schema_application_gateway_read.properties.ssl_certificates.Element.properties.hsm + hsm.key_id = AAZStrType( + serialized_name="keyId", + ) + hsm.public_cert_data = AAZStrType( + serialized_name="publicCertData", + ) + ssl_profiles = _schema_application_gateway_read.properties.ssl_profiles ssl_profiles.Element = AAZObjectType() diff --git a/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_unit_tests.py b/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_unit_tests.py index fe9a59d9dcd..a6785a20d6f 100644 --- a/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_unit_tests.py +++ b/src/azure-cli/azure/cli/command_modules/network/tests/latest/test_network_unit_tests.py @@ -125,5 +125,51 @@ def test_no_shared_key_without_cert_auth_should_raise(self): self.assertIn('--shared-key is required', str(ctx.exception)) + def test_application_gateway_parent_api_version(self): + """Parent application-gateway operations must use API version 2025-07-01 so that + Managed HSM SSL certificate fields (hsm.keyId / hsm.publicCertData) are preserved.""" + from azure.cli.command_modules.network.aaz.latest.network.application_gateway import _show, _create, _update + + for module, name in [(_show, "Show"), (_create, "Create"), (_update, "Update")]: + cls = getattr(module, name) + self.assertEqual( + cls._aaz_info["version"], + "2025-07-01", + msg=f"application-gateway {name}._aaz_info['version'] must be 2025-07-01", + ) + for resource in cls._aaz_info["resources"]: + self.assertEqual( + resource[-1], + "2025-07-01", + msg=f"application-gateway {name} resources entry must reference 2025-07-01", + ) + + def test_application_gateway_show_ssl_cert_hsm_schema(self): + """The parent application-gateway show response schema must include the + sslCertificates[].properties.hsm object with keyId and publicCertData.""" + from azure.cli.command_modules.network.aaz.latest.network.application_gateway._show import Show + + inner_cls = Show.ApplicationGatewaysGet + inner_cls._build_schema_on_200() + ssl_cert_props = inner_cls._schema_on_200.properties.ssl_certificates.Element.properties + fields = ssl_cert_props._fields + self.assertIn( + "hsm", + fields, + "ssl_certificates.Element.properties must contain 'hsm'", + ) + hsm_fields = fields["hsm"]._fields + self.assertIn( + "key_id", + hsm_fields, + "ssl_certificates.Element.properties.hsm must contain 'key_id'", + ) + self.assertIn( + "public_cert_data", + hsm_fields, + "ssl_certificates.Element.properties.hsm must contain 'public_cert_data'", + ) + + if __name__ == '__main__': unittest.main()