azure-search-openai-demo icon indicating copy to clipboard operation
azure-search-openai-demo copied to clipboard

The role assignment already exists. (Code: RoleAssignmentExists)

Open rpaGuyai opened this issue 1 year ago • 4 comments

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ X] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

azd up ----redeploying with changes in infra, already done the same multiple times without an issue.

Any log messages given by the failure

{"code":"RoleAssignmentExists","message":"The role assignment already exists."}

Expected/desired behavior

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

Windows 10

azd version?

run azd version and copy paste here.

azd version 1.4.4 (commit 45a48a32c9f3caad481343869ade05221df26ec7)

Versions

Mention any other details that might be useful

I ma facing issue while running azd up, though have successfully deployed multiple times.

{"code":"RoleAssignmentExists","message":"The role assignment already exists."}

Under deployment I can see the error comes for 'storage - role-user', ;formrecognizer role user, search contri role user and search role user. image


Thanks! We'll be in touch soon.

rpaGuyai avatar Dec 26 '23 09:12 rpaGuyai

Is it possible you're logged in with a different account now? Can you check the existing roles in the portal to see what user they're associated with. A quick fix would be to change the name in the bicep for each role: https://github.com/Azure-Samples/azure-search-openai-demo/blob/e518ab0589af8d8704761d85db68ec4dffbfef55/infra/main.bicep#L408

pamelafox avatar Jan 04 '24 15:01 pamelafox

@pamelafox Would you happen to know how to resolve this conflict in the portal in Azure? I am running into something quite similar where deployments related to role-user are failing. I am quite new to Azure and I could not find the role assignments pertaining to a deployment like openai-role-user.

ssjdan27 avatar Jul 04 '24 09:07 ssjdan27

Those role assignments are declared in main.bicep. If you haven't modified them, then there should only be a single role with each name. You can try changing names there, however.

pamelafox avatar Jul 10 '24 21:07 pamelafox

For me the problem was that I ran https://github.com/Azure-Samples/azure-search-openai-demo/blob/main/scripts/roles.sh which lead to conflicts on azd up. Removing my user from these roles on the reosurce group and then running azd up fixed it.

SC-CTS avatar Jun 05 '25 15:06 SC-CTS