question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Updating tags with `az ad sp update` runs into trace

See original GitHub issue

Describe the bug

Running az ad sp update --id $app_id --add tags WindowsAzureActiveDirectoryIntegratedApp runs into trace with cli version 2.37.0 (tested via rpm and container)

Command Name az ad sp update --id $app_id --add tags WindowsAzureActiveDirectoryIntegratedApp

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 "/usr/local/lib/python3.10/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/usr/local/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 "/usr/local/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 718, in _run_job
    return cmd_copy.exception_handler(ex)
  File "/usr/local/lib/python3.10/site-packages/azure/cli/command_modules/role/commands.py", line 54, in graph_err_handler
    raise ex
  File "/usr/local/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/usr/local/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 240, in handler
    result = cached_put(self.cmd, setter, **setterargs)
  File "/usr/local/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 452, in cached_put
    return _put_operation()
  File "/usr/local/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 446, in _put_operation
    result = operation(**kwargs)
  File "/usr/local/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…
  • DISPLAYNAME=my_SP_test01
  • app_id=$(az ad app list --display-name $DISPLAYNAME --query [].appId -o tsv)

Expected Behavior

Tags can either be added with the cli >= 2.37.0 and/or https://docs.microsoft.com/en-us/cli/azure/microsoft-graph-migration outlines alternative steps

Environment Summary

Linux-5.18.6-200.fc36.x86_64-x86_64-with, Alpine Linux v3.15
Python 3.10.4
Installer: DOCKER

azure-cli 2.37.0

Additional Context

This works still with az cli 2.35.0

podman run -it mcr.microsoft.com/azure-cli:2.35.0
bash-5.1# az version
{
  "azure-cli": "2.35.0",
  "azure-cli-core": "2.35.0",
  "azure-cli-telemetry": "1.0.6",
  "extensions": {}
}
bash-5.1# 
bash-5.1# az login
bash-5.1# DISPLAYNAME=my_SP_test01
bash-5.1# app_id=$(az ad app list --display-name $DISPLAYNAME --query [].appId -o tsv)
WARNING: The underlying Active Directory Graph API will be replaced by Microsoft Graph API in Azure CLI 2.37.0. Please carefully review all breaking changes introduced during this migration: https://docs.microsoft.com/cli/azure/microsoft-graph-migration
bash-5.1#  az ad sp update --id $app_id --add tags WindowsAzureActiveDirectoryIntegratedApp
The underlying Active Directory Graph API will be replaced by Microsoft Graph API in Azure CLI 2.37.0. Please carefully review all breaking changes introduced during this migration: https://docs.microsoft.com/cli/azure/microsoft-graph-migration
bash-5.1# 
bash-5.1# az ad sp show --id $app_id --query tags
The underlying Active Directory Graph API will be replaced by Microsoft Graph API in Azure CLI 2.37.0. Please carefully review all breaking changes introduced during this migration: https://docs.microsoft.com/cli/azure/microsoft-graph-migration
[
  "WindowsAzureActiveDirectoryIntegratedApp"
]
bash-5.1# 

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dmoessnecommented, Jun 27, 2022

Official Release: 07/05/2022

Thanks, If you don’t mind, I’d like to keep this open till 2.38.0 is released so I can test with the new version.

1reaction
jiaslicommented, Jun 27, 2022

This is a known issue that generic update argument --add doesn’t work with Microsoft Graph yet. In the next version 2.38.0, you may use --set to set tags property (https://github.com/Azure/azure-cli/pull/22798).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Release notes & updates – Azure CLI - Microsoft Learn
Learn about the latest Azure Command-Line Interface (CLI) release notes and updates for both the current and beta versions of the CLI.
Read more >
Azure CLI - Will "az ad" be updated to use Microsoft Graph API?
We will start the planning and implementation of Active Directory Graph -> Microsoft Graph migration once the previously task is done.
Read more >
Usage Tags - Qualtrics
Tagging users allows you to track how user seats are allocated across your organization. Include option for survey creators to tag their surveys:...
Read more >
Create and update the service principal key for Azure ... - OpsMx
To create a service principal and then update the AKS cluster to use these new credentials, use the az ad sp create-for-rbac command, ......
Read more >
Garmin Express Fails to Install or Update on a Windows ...
4. Verify the Computer Meets System Requirements for Garmin Express · Windows 7 Service Pack 1 or newer · Microsoft .NET 4.7.2 (included...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found