diff --git a/src/azure-cli/azure/cli/command_modules/appservice/custom.py b/src/azure-cli/azure/cli/command_modules/appservice/custom.py index 6f8e1bc2e0f..9914a9792d8 100644 --- a/src/azure-cli/azure/cli/command_modules/appservice/custom.py +++ b/src/azure-cli/azure/cli/command_modules/appservice/custom.py @@ -2584,14 +2584,14 @@ def _update_ssl_binding(cmd, resource_group_name, name, certificate_thumbprint, if webapp_cert.thumbprint == certificate_thumbprint: found_cert = webapp_cert if found_cert: - if len(webapp_cert.host_names) == 1 and not webapp_cert.host_names[0].startswith('*'): + if len(found_cert.host_names) == 1 and not found_cert.host_names[0].startswith('*'): return _update_host_name_ssl_state(cmd, resource_group_name, name, webapp, - webapp_cert.host_names[0], ssl_type, + found_cert.host_names[0], ssl_type, certificate_thumbprint, slot) query_result = list_hostnames(cmd, resource_group_name, name, slot) hostnames_in_webapp = [x.name.split('/')[-1] for x in query_result] - to_update = _match_host_names_from_cert(webapp_cert.host_names, hostnames_in_webapp) + to_update = _match_host_names_from_cert(found_cert.host_names, hostnames_in_webapp) for h in to_update: _update_host_name_ssl_state(cmd, resource_group_name, name, webapp, h, ssl_type, certificate_thumbprint, slot)