Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Start-AMBACleanup is not removing role assignment #42

Closed
1 task done
anwather opened this issue Oct 19, 2023 · 6 comments · Fixed by #44
Closed
1 task done

[Bug]: Start-AMBACleanup is not removing role assignment #42

anwather opened this issue Oct 19, 2023 · 6 comments · Fixed by #44
Assignees
Labels
bug Something isn't working Pattern: ALZ 🚁 Issues / PR's related to the ALZ Pattern question Further information is requested

Comments

@anwather
Copy link
Contributor

Check for previous/existing GitHub issues

  • I have checked for previous/existing GitHub issues

Description

I think that the Start-AMBACleanup script isn't removing the role assignments - it is leaving these orphaned roles.
image
At the management group levels underneath this there is the same thing as well - one for each of identity/management/connectivity management groups e.g.
image

I noticed this due to attempting to deploy the solution multiple times and it not being able to deploy the role assignments again (said it was unable to update them)

@anwather anwather added the question Further information is requested label Oct 19, 2023
@arjenhuitema
Copy link
Contributor

Thank you @anwather for raising this issue. I will add this to our backlog and report here when its been resolved. As a work around, after running the cleanup script you can delete the assignments manually before redeploying.

@arjenhuitema arjenhuitema added the bug Something isn't working label Oct 19, 2023
@arjenhuitema arjenhuitema self-assigned this Oct 19, 2023
@mbrat2005
Copy link
Contributor

Hi @anwather, thanks for raising this issue! I am working to reproduce what you are seeing so we can get it fixed. The cleanup scripts are written to be conservative in that they delete, so slight changes to the environment might mean the cleanup is incomplete. The way that we determine which Role Assignments to clean up with the Start-AMBACleanup script is:

  1. Get a list of Policy Assignments with the metadata property '_deployed_by_amba=True'
  2. From the list of Policy Assignments, we pull out the Assignment identity's principal ID
  3. Query for Role Assignments to each Policy Assignment identity where the Role Assignment's description property is '_deployed_by_amba'

If you happen to have done any of the following, the script will not clean up the Role Assignments:

  • Removed the metadata on the Policy Assignment
  • Removed the Policy Assignment manually
  • Manually changed the Policy Assignment identity and recreated the Role Assignment (such as in the Portal)
  • Removed the Role Assignment description

To help troubleshoot, can you please confirm that the role assignments in your screenshot have the description value '_deployed_by_amba'? To see the Description in the Portal, if you navigate to your connectivity Management Group, go to Access Control (IAM), then choose 'Edit Columns' at the top of the screen and check the box next to Description.

@paulgrimley
Copy link
Contributor

paulgrimley commented Oct 19, 2023 via email

@anwather
Copy link
Contributor Author

Yes they have that description :)
image

Maybe it needs to remove the role assignment first before removing the assignment?

@arjenhuitema arjenhuitema linked a pull request Oct 23, 2023 that will close this issue
6 tasks
@mbrat2005
Copy link
Contributor

I was unable to reproduce this issue, but the changes in the associated PR should help make the role assignment cleanup more reliable (less complex). If we see this again, we'll need to dig into activity and deployment logs to demonstrate that we, via our automation, are creating role assignments which are missing descriptions.

I've let @anwather know and he will close the issue after any other investigation on his side.

@arjenhuitema
Copy link
Contributor

I was able to reproduce the issue and with #44 it was resolved.

@Brunoga-MS Brunoga-MS added the Pattern: ALZ 🚁 Issues / PR's related to the ALZ Pattern label Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Pattern: ALZ 🚁 Issues / PR's related to the ALZ Pattern question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants