Skip to content

{App Service} az webapp config ssl import: Fix AttributeError with azure-mgmt-web 11.0.0#33705

Open
seligj95 wants to merge 2 commits into
Azure:devfrom
seligj95:jordanselig-microsoft-turbo-fiesta
Open

{App Service} az webapp config ssl import: Fix AttributeError with azure-mgmt-web 11.0.0#33705
seligj95 wants to merge 2 commits into
Azure:devfrom
seligj95:jordanselig-microsoft-turbo-fiesta

Conversation

@seligj95

@seligj95 seligj95 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #33542

az webapp config ssl import fails with:

AttributeError: 'WebSiteManagementClient' object has no attribute 'app_service_certificate_orders'

Root cause

The azure-mgmt-web 11.0.0 upgrade (shipped in CLI 2.87.0) switched WebSiteManagementClient from a multi-api client to a single-api client (api-version 2025-05-01). That client no longer exposes the app_service_certificate_orders operation group — those operations belong to the separate Microsoft.CertificateRegistration resource provider. import_ssl_cert accessed client.app_service_certificate_orders, which now raises AttributeError.

A prior change added a hasattr(...) guard that merely suppressed the crash, silently breaking App Service Certificate secret-name resolution.

Fix

Added _get_app_service_certificate_kv_secret_name() which resolves the Key Vault secret name via a direct ARM REST call to Microsoft.CertificateRegistration/certificateOrders (api 2022-09-01), with pagination and graceful error handling. import_ssl_cert now calls it, restoring the original behavior for purchased App Service Certificates without depending on the dropped SDK operation group.

Testing

  • New unit tests (test_import_ssl_cert.py): match, no-match, pagination, and error handling — all pass.
  • flake8 / pylint clean on the changed region.
  • Live end-to-end test against a real App Service Certificate: command succeeds (no AttributeError) and correctly resolves the certificate order's actual Key Vault secret name rather than the certificate name.

…pp Service Certificates with azure-mgmt-web 11.0.0

The azure-mgmt-web 11.0.0 upgrade switched WebSiteManagementClient to a
single-api (2025-05-01) client that no longer exposes the
'app_service_certificate_orders' operation group, which lives under the
Microsoft.CertificateRegistration provider. This caused
'az webapp config ssl import' to fail with
"'WebSiteManagementClient' object has no attribute 'app_service_certificate_orders'".

Resolve the App Service Certificate Key Vault secret name via a direct ARM
REST call to Microsoft.CertificateRegistration/certificateOrders instead.

Fixes Azure#33542

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 6, 2026 15:36
@seligj95 seligj95 requested a review from a team as a code owner July 6, 2026 15:36
@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Jul 6, 2026

Copy link
Copy Markdown
️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.14
️✔️acs
️✔️latest
️✔️3.12
️✔️3.14
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.14
️✔️ams
️✔️latest
️✔️3.12
️✔️3.14
️✔️apim
️✔️latest
️✔️3.12
️✔️3.14
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.14
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.14
️✔️aro
️✔️latest
️✔️3.12
️✔️3.14
️✔️backup
️✔️latest
️✔️3.12
️✔️3.14
️✔️batch
️✔️latest
️✔️3.12
️✔️3.14
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.14
️✔️billing
️✔️latest
️✔️3.12
️✔️3.14
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.14
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.14
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.14
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.14
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.14
️✔️config
️✔️latest
️✔️3.12
️✔️3.14
️✔️configure
️✔️latest
️✔️3.12
️✔️3.14
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.14
️✔️container
️✔️latest
️✔️3.12
️✔️3.14
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.14
️✔️core
️✔️latest
️✔️3.12
️✔️3.14
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.14
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.14
️✔️dls
️✔️latest
️✔️3.12
️✔️3.14
️✔️dms
️✔️latest
️✔️3.12
️✔️3.14
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.14
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.14
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.14
️✔️find
️✔️latest
️✔️3.12
️✔️3.14
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.14
️✔️identity
️✔️latest
️✔️3.12
️✔️3.14
️✔️iot
️✔️latest
️✔️3.12
️✔️3.14
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.14
️✔️lab
️✔️latest
️✔️3.12
️✔️3.14
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.14
️✔️maps
️✔️latest
️✔️3.12
️✔️3.14
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.14
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.14
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.14
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.14
️✔️network
️✔️latest
️✔️3.12
️✔️3.14
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.14
️✔️postgresql
️✔️latest
️✔️3.12
️✔️3.14
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.14
️✔️profile
️✔️latest
️✔️3.12
️✔️3.14
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.14
️✔️redis
️✔️latest
️✔️3.12
️✔️3.14
️✔️relay
️✔️latest
️✔️3.12
️✔️3.14
️✔️resource
️✔️latest
️✔️3.12
️✔️3.14
️✔️role
️✔️latest
️✔️3.12
️✔️3.14
️✔️search
️✔️latest
️✔️3.12
️✔️3.14
️✔️security
️✔️latest
️✔️3.12
️✔️3.14
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.14
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.14
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.14
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.14
️✔️sql
️✔️latest
️✔️3.12
️✔️3.14
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.14
️✔️storage
️✔️latest
️✔️3.12
️✔️3.14
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.14
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.14
️✔️util
️✔️latest
️✔️3.12
️✔️3.14
️✔️vm
️✔️latest
️✔️3.12
️✔️3.14

@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Jul 6, 2026

Copy link
Copy Markdown
️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

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.

Pull request overview

This PR fixes az webapp config ssl import failing on azure-mgmt-web 11.0.0+ by restoring App Service Certificate Key Vault secret-name resolution without relying on the removed app_service_certificate_orders SDK operation group.

Changes:

  • Added _get_app_service_certificate_kv_secret_name() to query Microsoft.CertificateRegistration/certificateOrders via ARM REST (with pagination and error handling).
  • Updated import_ssl_cert to use the new helper instead of the removed SDK operation group.
  • Added unit tests covering match/no-match, pagination, and error behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/azure-cli/azure/cli/command_modules/appservice/custom.py Replaces the deprecated SDK access with a direct ARM REST query to resolve the correct Key Vault secret name for App Service Certificates.
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_import_ssl_cert.py Adds unit tests validating secret-name resolution logic, pagination, and graceful failure handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/azure-cli/azure/cli/command_modules/appservice/custom.py Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@yonzhan

yonzhan commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

App Service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

az webapp config ssl import fails with error 'WebSiteManagementClient' object has no attribute 'app_service_certificate_orders'

5 participants