diff --git a/src/containerapp/HISTORY.rst b/src/containerapp/HISTORY.rst index 1dc3c671855..1d1d09b8d04 100644 --- a/src/containerapp/HISTORY.rst +++ b/src/containerapp/HISTORY.rst @@ -4,6 +4,8 @@ Release History =============== Upcoming ++++++ +* 'az containerapp hostname bind': fix bug where the prompt for validation method didn't take value in +* Make --validation-method parameter case insensitive for 'az containerapp hostname bind' and 'az containerapp env certificate create' * 'az containerapp auth update': remove unsupported argument --enable-token-store * 'az containerapp update'/'az containerapp env update': fix --no-wait * 'az containerapp update': fix the --yaml update behavior to respect the empty array in patch-request diff --git a/src/containerapp/azext_containerapp/custom.py b/src/containerapp/azext_containerapp/custom.py index ac55933008b..11d418dcca8 100644 --- a/src/containerapp/azext_containerapp/custom.py +++ b/src/containerapp/azext_containerapp/custom.py @@ -2930,9 +2930,9 @@ def create_managed_certificate(cmd, name, resource_group_name, hostname, validat cert_name = generate_randomized_managed_cert_name(hostname, resource_group_name) if not check_managed_cert_name_availability(cmd, resource_group_name, name, certificate_name): cert_name = None - certificate_envelop = prepare_managed_certificate_envelop(cmd, name, resource_group_name, hostname, validation_method) + certificate_envelop = prepare_managed_certificate_envelop(cmd, name, resource_group_name, hostname, validation_method.upper()) try: - r = ManagedEnvironmentClient.create_or_update_managed_certificate(cmd, resource_group_name, name, cert_name, certificate_envelop, True, validation_method == 'TXT') + r = ManagedEnvironmentClient.create_or_update_managed_certificate(cmd, resource_group_name, name, cert_name, certificate_envelop, True, validation_method.upper() == 'TXT') return r except Exception as e: handle_raw_exception(e) @@ -3157,13 +3157,13 @@ def bind_hostname(cmd, resource_group_name, name, hostname, thumbprint=None, cer cert_name = random_name logger.warning("Creating managed certificate '%s' for %s.\nIt may take up to 20 minutes to create and issue a managed certificate.", cert_name, standardized_hostname) - validation = validation_method + validation = validation_method.upper() while validation not in ["TXT", "CNAME", "HTTP"]: - validation = prompt_str('\nPlease choose one of the following domain validation methods: TXT, CNAME, HTTP\nYour answer: ') + validation = prompt_str('\nPlease choose one of the following domain validation methods: TXT, CNAME, HTTP\nYour answer: ').upper() - certificate_envelop = prepare_managed_certificate_envelop(cmd, env_name, resource_group_name, standardized_hostname, validation_method, location) + certificate_envelop = prepare_managed_certificate_envelop(cmd, env_name, resource_group_name, standardized_hostname, validation, location) try: - managed_cert = ManagedEnvironmentClient.create_or_update_managed_certificate(cmd, resource_group_name, env_name, cert_name, certificate_envelop, False, validation_method == 'TXT') + managed_cert = ManagedEnvironmentClient.create_or_update_managed_certificate(cmd, resource_group_name, env_name, cert_name, certificate_envelop, False, validation == 'TXT') except Exception as e: handle_raw_exception(e) cert_id = managed_cert["id"] diff --git a/src/containerapp/azext_containerapp/tests/latest/test_containerapp_env_commands.py b/src/containerapp/azext_containerapp/tests/latest/test_containerapp_env_commands.py index 50a5cf0515f..f7a832829a7 100644 --- a/src/containerapp/azext_containerapp/tests/latest/test_containerapp_env_commands.py +++ b/src/containerapp/azext_containerapp/tests/latest/test_containerapp_env_commands.py @@ -295,13 +295,13 @@ def test_containerapp_env_certificate_e2e(self, resource_group): self.cmd('containerapp hostname add -g {} -n {} --hostname {}'.format(resource_group, ca_name, hostname_1), expect_failure=True) # create a managed certificate - self.cmd('containerapp env certificate create -n {} -g {} --hostname {} -v CNAME -c {}'.format(env_name, resource_group, hostname_1, cert_name), checks=[ + self.cmd('containerapp env certificate create -n {} -g {} --hostname {} -v cname -c {}'.format(env_name, resource_group, hostname_1, cert_name), checks=[ JMESPathCheck('type', "Microsoft.App/managedEnvironments/managedCertificates"), JMESPathCheck('name', cert_name), JMESPathCheck('properties.subjectName', hostname_1), ]).get_output_in_json() - self.cmd('containerapp env certificate create -n {} -g {} --hostname {} -v CNAME'.format(env_name, resource_group, hostname_1), expect_failure=True) + self.cmd('containerapp env certificate create -n {} -g {} --hostname {} -v cname'.format(env_name, resource_group, hostname_1), expect_failure=True) self.cmd('containerapp env certificate list -g {} -n {} -m'.format(resource_group, env_name), checks=[ JMESPathCheck('length(@)', 1), ]) @@ -316,7 +316,7 @@ def test_containerapp_env_certificate_e2e(self, resource_group): JMESPathCheck('length(@)', 0), ]) - self.cmd('containerapp hostname bind -g {} -n {} --hostname {} --environment {} -v CNAME'.format(resource_group, ca_name, hostname_1, env_name)) + self.cmd('containerapp hostname bind -g {} -n {} --hostname {} --environment {} -v cname'.format(resource_group, ca_name, hostname_1, env_name)) certs = self.cmd('containerapp env certificate list -g {} -n {}'.format(resource_group, env_name), checks=[ JMESPathCheck('length(@)', 1), ]).get_output_in_json()