Skip to content

AttributeError: 'RoleAssignmentsOperations' object has no attribute 'config' when using az ad sp create-for-rbac #24959

@k-byun

Description

@k-byun

Describe the bug

Not sure how to go about fixing this - getting an error shown at the title of the issue.

Command Name
az ad sp create-for-rbac

Errors:

The command failed with an unexpected error. Here is the traceback:
'RoleAssignmentsOperations' object has no attribute 'config'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 718, in _run_job
    return cmd_copy.exception_handler(ex)
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/role/commands.py", line 51, in graph_err_handler
    raise ex
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/role/custom.py", line 1246, in create_service_principal_for_rbac
    _create_role_assignment(cmd.cli_ctx, role, sp_oid, None, scope, resolve_assignee=False,
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/role/custom.py", line 198, in _create_role_assignment
    assignments_client.config.subscription_id)
AttributeError: 'RoleAssignmentsOperations' object has no attribute 'config'

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 create-for-rbac --name {} --role {} --scopes {} --sdk-auth

Expected Behavior

Environment Summary

Linux-6.0.0-kali5-amd64-x86_64-with-glibc2.36, Kali GNU/Linux Rolling
Python 3.10.9
Installer: DEB

azure-cli 2.43.0

Extensions:
azure-devops 0.25.0

Dependencies:
msal 1.20.0
azure-mgmt-resource 21.2.1

Additional Context

Metadata

Metadata

Assignees

Labels

Auto-AssignAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamGraph(doesn't work with label-triggered comments; use Graph.Microsoft instead) az adact-identity-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.feature-request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions