Adding tag to service principal fails
See original GitHub issueThis is autogenerated. Please review and update as needed.
Describe the bug
Command Name
az ad sp update
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 "/opt/homebrew/Cellar/azure-cli/2.37.0/libexec/lib/python3.10/site-packages/knack/cli.py", line 231, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/homebrew/Cellar/azure-cli/2.37.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
raise ex
File "/opt/homebrew/Cellar/azure-cli/2.37.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/homebrew/Cellar/azure-cli/2.37.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 718, in _run_job
return cmd_copy.exception_handler(ex)
File "/opt/homebrew/Cellar/azure-cli/2.37.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/role/commands.py", line 54, in graph_err_handler
raise ex
File "/opt/homebrew/Cellar/azure-cli/2.37.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
result = cmd_copy(params)
File "/opt/homebrew/Cellar/azure-cli/2.37.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
return self.handler(*args, **kwargs)
File "/opt/homebrew/Cellar/azure-cli/2.37.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 240, in handler
result = cached_put(self.cmd, setter, **setterargs)
File "/opt/homebrew/Cellar/azure-cli/2.37.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 452, in cached_put
return _put_operation()
File "/opt/homebrew/Cellar/azure-cli/2.37.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 446, in _put_operation
result = operation(**kwargs)
File "/opt/homebrew/Cellar/azure-cli/2.37.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/role/custom.py", line 988, in patch_service_principal
object_id = _resolve_service_principal(graph_client.service_principals, identifier)
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.
- Put any pre-requisite steps here…
az ad sp update --id {} --add --tags "mytag" --debug
Expected Behavior
Environment Summary
macOS-12.4-arm64-arm-64bit, Darwin 21.5.0
Python 3.10.4
Installer: HOMEBREW
azure-cli 2.37.0
Extensions:
application-insights 0.1.15
Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1
Additional Context
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Tagging service principals with az ad sp update --id appID ...
Tagging service principals with az ad sp update --id appID --add tags throws "Update to existing credential with KeyId 'keyID' is not allowed."...
Read more >Error while creating service principal using power shell
While following the steps to create service principal in powershell,error received is : ~$ az ad sp create-for-rbac -n "SvcPrincipal1" This ...
Read more >Insufficient privileges to complete the operation with listing ...
Hi I'm trying to use the Azure CLI command logged in a service principal. az ad sp list.
Read more >Creating and managing tags - Google Cloud
Click person Manage access. To add a role to a principal, click person_add Add principal. In the New principals text box, enter the ......
Read more >Controlling access to and for IAM users and roles using tags
However, when you tag a user in IAM, this also controls whether the principal can make the request to any service. For more...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you @jiasli, changing
$body = '{"tags":["mytag"]}'
to$body = '{"tags":[\"mytag\"]}'
worked.@andygjp, you are hitting a known PowerShell issue: https://github.com/Azure/azure-cli/issues/15529