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

[Utilities] Fixing Update-NestedRoleAssignmentList.ps1 script to support 'Microsoft.Authorization/roleAssignments' module #2369

Merged
merged 13 commits into from
Nov 26, 2022

Conversation

krbar
Copy link
Contributor

@krbar krbar commented Nov 25, 2022

Description

The PR resolves #2292 and fixes the script Update-NestedRoleAssignmentList.ps1 to also update the built-in roles in the 'Microsoft.Authorization/roleAssignments' and its sub-modules.

Background:
Unlike all other modules, the list of built-in roles in the module 'Microsoft.Authorization/roleAssignments' is not stored in the file .bicep/nested_roleAssignments.bicep, but in the deploy.bicep files of the child-modules. This caused that the old logic of the Update-NestedRoleAssignmentList.ps1 was not able to find and update the roles there.

Details:

  • Updates of the script Get-RoleAssignmentList.ps1
    • no filtering of roles for 'Microsoft.Authorization/roleAssignments'. Returning all non-custom roles.
    • different output format for 'Microsoft.Authorization/roleAssignments'
  • renaming the script Update-NestedRoleAssignmentList.ps1 and its functions: removing "Nested" from the name: Update-RoleAssignmentList.ps1
  • update of the Update-RoleAssignmentList.ps1 to cover the special case of the module 'Microsoft.Authorization/roleAssignments'
  • modifications of the module 'Microsoft.Authorization/roleAssignments'
    • renaming variable builtInRoleNamesVar to builtInRoleNames in the child modules of 'Microsoft.Authorization/roleAssignments'. This aligns the name of this variable to match all other modules, which simplifies the update process.
    • alphabetical sort of the roles list
    • update of the roles list (using the Update-RoleAssignmentList.ps1)

Pipeline references

For module/pipeline changes, please create and attach the status badge of your successful run.

Pipeline
Authorization: RoleAssignments

Type of Change

  • Bugfix (non-breaking change which fixes an issue)

Checklist

  • I'm sure there are no other open Pull Requests for the same update/change
  • My corresponding pipelines / checks run clean and green without any errors or warnings
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (readme)
  • I did format my code

@krbar krbar marked this pull request as ready for review November 25, 2022 20:52
@krbar krbar requested a review from a team as a code owner November 25, 2022 20:52
@AlexanderSehr AlexanderSehr added enhancement New feature or request [cat] utilities category: utilities labels Nov 25, 2022
@krbar krbar merged commit ebe390d into main Nov 26, 2022
@krbar krbar deleted the users/krbar/2292-roleAssignmentList branch November 26, 2022 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[cat] utilities category: utilities enhancement New feature or request
Projects
None yet
2 participants