Azure / Azure/azure-cli

az role assignment create is NOT idempotent

Open
#25,872 4 comments 0 reactions 0 assignees View on GitHub
act-codegen-extensibility-squad Auto-Assign customer-reported Service Attention Synapse
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### **This is autogenerated. Please review and update as needed.**

## Describe the bug

**Command Name**
`az synapse role assignment create`

**Errors:**
```
(RoleAssignmentAlreadyExists) Role Assignment with roleId '6e4bf58a-b8e1-4cc3-bbf9-d73143322b78', principalId '1db446b3-dc3e-4eb5-b703-253431f879af' and scope 'workspaces/syntestadmin1982' within workspace 'syntestadmin1982' already exists.
Code: RoleAssignmentAlreadyExists
Message: Role Assignment with roleId '6e4bf58a-b8e1-4cc3-bbf9-d73143322b78', principalId '1db446b3-dc3e-4eb5-b703-253431f879af' and scope 'workspaces/syntestadmin1982' within workspace 'syntestadmin1982' already exists.
```

## To Reproduce:
Run the role assignment command twice. First time it will succeed if this role wasn't assigned before, second time will fail because it already exists.

- _Put any pre-requisite steps here..._
- `az synapse role assignment create --workspace-name {} --role {} --assignee {}`

## Expected Behavior
Not to fail but return the current assignment info. Similar to az role assignment to be idempotent to be used in automation.

## Environment Summary
```
Windows-10-10.0.19044-SP0
Python 3.10.10
Installer: MSI

azure-cli 2.46.0

Extensions:
bastion 0.2.1

Dependencies:
msal 1.20.0
azure-mgmt-resource 21.1.0b1
```
## 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.