Skip to content
New issue

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

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

Already on GitHub? # to your account

Resource Removal: Add resource Group support for mg level deployments #1043

Merged
merged 5 commits into from
Feb 28, 2022

Conversation

ahmadabdalla
Copy link
Contributor

@ahmadabdalla ahmadabdalla commented Feb 25, 2022

Closes #1042

Change

  • Allowed 'Resource Group Removal' within a 'Management Group' Scope deployment.

Without this, removal stage for deployments that happen at the management group scope and target resource group as child will not be able to find the right deployment as the original one only supports subscription as a child

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

@ahmadabdalla ahmadabdalla added bug Something isn't working [prio] high importance of the issue: high priority labels Feb 25, 2022
@ahmadabdalla ahmadabdalla added this to the v 0.5 milestone Feb 25, 2022
@ahmadabdalla ahmadabdalla self-assigned this Feb 25, 2022
@github-actions
Copy link

github-actions bot commented Feb 25, 2022

Unit Test Results

  1 files  1 suites   17s ⏱️
  1 tests 1 ✔️   0 💤 0
35 runs  1 ✔️ 34 💤 0

Results for commit 94c583d.

♻️ This comment has been updated with latest results.

@ahmadabdalla ahmadabdalla changed the title Add resource Group support for mg level deployments Resource Removal: Add resource Group support for mg level deployments Feb 25, 2022
@ahmadabdalla ahmadabdalla marked this pull request as ready for review February 25, 2022 05:53
@ahmadabdalla
Copy link
Contributor Author

Log Evidence

VERBOSE: Invoke task with
  VERBOSE: {
    "ManagementGroupId": "***",
    "DeploymentName": "roleDefinitions-20220225T0502569172Z",
    "ResourceGroupName": "validation-rg",
    "Verbose": true,
    "TemplateFilePath": "/home/runner/work/ResourceModules/ResourceModules/arm/Microsoft.Authorization/roleDefinitions/deploy.bicep"
  }
  
  VERBOSE: Template file path: [/home/runner/work/ResourceModules/ResourceModules/arm/Microsoft.Authorization/roleDefinitions/deploy.bicep]
  VERBOSE: Module name: [roleDefinitions]
  VERBOSE: Handling resource removal with deployment name [roleDefinitions-20220225T0502569172Z]
  VERBOSE: Determined deployment scope [managementgroup]
  VERBOSE: Found deployed resource [/subscriptions/***/resourceGroups/validation-rg/providers/Microsoft.Authorization/roleDefinitions/2abcf71f-a840-5ac1-bac2-9d12[546](https://github.com/Azure/ResourceModules/runs/5329519376?check_suite_focus=true#step:4:546)e0ba9]
  VERBOSE: Total number of deployment target resources after fetching deployments [1]
  VERBOSE: Total number of deployment target resources  after pre-filtering (duplicates) & ordering items [1]
  VERBOSE: Total number of deployment target resources after formatting items [1]
  VERBOSE: Using local tokens [namePrefix]
  VERBOSE: Total number of deployments after filtering all dependency resources [1]
  VERBOSE: Total number of deployments after final ordering of resources [1]
  VERBOSE: Performing the operation "Remove" on target "[1] resources".
  VERBOSE: Performing the operation "Remove" on target "[1] Resource(s) with a maximum of [3] attempts.".
  VERBOSE: - Remove [/subscriptions/***/resourceGroups/validation-rg/providers/Microsoft.Authorization/roleDefinitions/2abcf71f-a840-5ac1-bac2-9d12546e0ba9]
  VERBOSE: ----------------------------------
  VERBOSE: Removing resource [2abcf71f-a840-5ac1-bac2-9d12546e0ba9] of type [Microsoft.Authorization/roleDefinitions]
  VERBOSE: Performing the operation "Remove" on target "Resource [/subscriptions/***/resourceGroups/validation-rg/providers/Microsoft.Authorization/roleDefinitions/2abcf71f-a840-5ac1-bac2-9d12546e0ba9]".
  VERBOSE: Resource ID [/subscriptions/***/resourceGroups/validation-rg/providers/Microsoft.Authorization/roleDefinitions/2abcf71f-a840-5ac1-bac2-9d12546e0ba9]
  VERBOSE: Resource Type [Microsoft.Authorization/roleDefinitions]
  VERBOSE: Performing the operation "Execute" on target "Post-resource-removal for [/subscriptions/***/resourceGroups/validation-rg/providers/Microsoft.Authorization/roleDefinitions/2abcf71f-a840-5ac1-bac2-9d12546e0ba9]".
  VERBOSE: ----------------------------------
  VERBOSE: The removal completed successfully

Pipeline tested

Tested on the Role Definition Pipeline by adding a new parameter that targets Resource Group. Switched the workflow to use the root deploy.bicep and then reverted the configuration

@AlexanderSehr AlexanderSehr merged commit 3bd8c62 into main Feb 28, 2022
@AlexanderSehr AlexanderSehr deleted the users/ahmad/bugFix_removal branch February 28, 2022 19:07
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working [prio] high importance of the issue: high priority
Projects
None yet
2 participants