Skip to content

Updating tags with az ad sp update runs into trace #23027

@dmoessne

Description

@dmoessne

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# 

Metadata

Metadata

Assignees

Labels

Accountaz login/accountAuto-AssignAuto assign by botGraphaz 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