Skip to content

az ad sp update: GraphClient object has no attribute service_principals  #22777

@StefanPuntNL

Description

@StefanPuntNL

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Related command

az ad sp update

Describe the bug

The following error appears after executing the command.

az ad sp update --id "<app id here>" --set appRoleAssignmentRequired=true
This command or command group has been migrated to Microsoft Graph API. Please carefully review all breaking changes introduced during this migratiicrosoft.com/cli/azure/microsoft-graph-migration
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/role/commands.py", line 54, in graph_err_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 240, in handler
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 452, in cached_put
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 446, in _put_operation
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/role/custom.py", line 988, in patch_service_princi
AttributeError: 'GraphClient' object has no attribute 'service_principals'

To Reproduce

  1. Create new app registration
  2. Execute the command: az ad sp update --id "<app id here>" --set appRoleAssignmentRequired=true

Expected behavior

Worked as expected in 2.36.0

Environment summary

Win10 20H2 19042.1706
Python (Windows) 3.10.4 
Installer: MSI

azure-cli                         2.37.0

core                              2.37.0
telemetry                          1.0.6

Extensions:
account                            0.2.1
azure-firewall                    0.12.0

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

Additional context

A similar issue with the appservice module was reported here:
#22722

Metadata

Metadata

Assignees

Labels

Auto-AssignAuto assign by botGraph(doesn't work with label-triggered comments; use Graph.Microsoft instead) az adcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions