Azure / Azure/azure-cli

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

Open
#24,959 8 comments 1 reaction 1 assignee Claimed by @jiasli View on GitHub
act-identity-squad Auto-Assign Azure CLI Team customer-reported feature-request Graph
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

## 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.