Azure / azure-cli

Azure Command-Line Interface
MIT License
4.01k stars 2.99k forks source link

`az webapp config ssl import` fails: AttributeError: 'GraphClient' object has no attribute 'service_principals' #22722

Closed christianhelle closed 2 years ago

christianhelle commented 2 years ago

Description

Command Name az webapp config ssl import

Errors:

The command failed with an unexpected error. Here is the traceback:
'GraphClient' object has no attribute 'service_principals'
Traceback (most recent call last):
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 663, in execute
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 718, in _run_job
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/commands.py", line 39, in _ex_handler
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 697, in _run_job
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 333, in __call__
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/custom.py", line 2700, in import_ssl_cert
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/custom.py", line 2779, in _check_service_principal_permissions
AttributeError: 'GraphClient' object has no attribute 'service_principals'

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

az webapp config ssl import --resource-group [VALID RESOURCE GROUP ON SAME SUBSCRIPTION] --name [VALID APP SERVICE ON RESOURCE GROUP] --key-vault '/subscriptions/[VALID SUBSCRIPTION]/resourceGroups/[VALID RESOURCE GROUP]/providers/Microsoft.KeyVault/vaults/[VALID KEYVAULT ON RESOURCE GROUP]' --key-vault-certificate-name [VALID CERTIFICATE ON KEYVAULT]

Expected Behavior

This worked fine with Azure CLI v2.35

Environment Summary

Windows-10-10.0.19044-SP0
Python 3.10.4
Installer: MSI

azure-cli 2.37.0

Extensions:
application-insights 0.1.16
azure-cli-iot-ext 0.8.10
azure-devops 0.25.0
azure-iot 0.14.1
databricks 0.8.0
log-analytics 0.2.2
portal 0.1.2
resource-graph 2.1.0
storage-preview 0.8.3
subscription 0.1.5

Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1

Additional Context

jiasli commented 2 years ago

Importing protected method _graph_client_factory is never a supported usage.

https://github.com/Azure/azure-cli/blob/ccdc56e7806b6544ddf228bb04be83e485a7611a/src/azure-cli/azure/cli/command_modules/appservice/custom.py#L2767-L2779

appservice should migrate to the new GraphClient. See

ghost commented 2 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzureAppServiceCLI, @antcp.

Issue Details
## Description **Command Name** `az webapp config ssl import` **Errors:** ``` The command failed with an unexpected error. Here is the traceback: 'GraphClient' object has no attribute 'service_principals' Traceback (most recent call last): File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 663, in execute File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 718, in _run_job File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/commands.py", line 39, in _ex_handler File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 697, in _run_job File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 333, in __call__ File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/custom.py", line 2700, in import_ssl_cert File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/custom.py", line 2779, in _check_service_principal_permissions AttributeError: 'GraphClient' object has no attribute 'service_principals' ``` ## To Reproduce: Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information. ``` az webapp config ssl import --resource-group [VALID RESOURCE GROUP ON SAME SUBSCRIPTION] --name [VALID APP SERVICE ON RESOURCE GROUP] --key-vault '/subscriptions/[VALID SUBSCRIPTION]/resourceGroups/[VALID RESOURCE GROUP]/providers/Microsoft.KeyVault/vaults/[VALID KEYVAULT ON RESOURCE GROUP]' --key-vault-certificate-name [VALID CERTIFICATE ON KEYVAULT] ``` ## Expected Behavior This worked fine with Azure CLI v2.35 ## Environment Summary ``` Windows-10-10.0.19044-SP0 Python 3.10.4 Installer: MSI azure-cli 2.37.0 Extensions: application-insights 0.1.16 azure-cli-iot-ext 0.8.10 azure-devops 0.25.0 azure-iot 0.14.1 databricks 0.8.0 log-analytics 0.2.2 portal 0.1.2 resource-graph 2.1.0 storage-preview 0.8.3 subscription 0.1.5 Dependencies: msal 1.18.0b1 azure-mgmt-resource 21.1.0b1 ``` ## Additional Context
Author: christianhelle
Assignees: jiasli, panchagnula
Labels: `Web Apps`, `Service Attention`, `Graph`, `customer-reported`, `CXP Attention`, `Auto-Assign`
Milestone: Backlog
yonzhan commented 2 years ago

route to CXP team

panchagnula commented 2 years ago

@jiasli we will work on migration on this extension. Sorry we should have identified this on our end earlier.

rmcolbert commented 2 years ago

I have confirmed that this worked properly in v2.36.0 also.

tmccart1 commented 2 years ago

This is causing the CD pipeline to fail for my public web site...is there any time estimate on when this will be corrected?

navba-MSFT commented 2 years ago

Service team has been involved already. So removing the CXP attention label from this.

Mike-Becatti commented 2 years ago

Any updates?