Skip to content

Commit

Permalink
feat: Added alias case handling for resource ID resolution in removal…
Browse files Browse the repository at this point in the history
… logic (#1873)

## Description

Added alias case handling for resource ID resolution in removal logic

## Pipeline Reference

<!-- Insert your Pipeline Status Badge below -->

| Pipeline |
| -------- |
|
[![avm.res.key-vault.vault](https://github.com/Azure/bicep-registry-modules/actions/workflows/avm.res.key-vault.vault.yml/badge.svg?branch=users%2Falsehr%2FaliasResolutino&event=workflow_dispatch)](https://github.com/Azure/bicep-registry-modules/actions/workflows/avm.res.key-vault.vault.yml)
|

## Type of Change

<!-- Use the check-boxes [x] on the options that are relevant. -->

- [x] Update to CI Environment or utlities (Non-module effecting
changes)
- [ ] Azure Verified Module updates:
- [ ] Bugfix containing backwards compatible bug fixes, and I have NOT
bumped the MAJOR or MINOR version in `version.json`:
- [ ] Someone has opened a bug report issue, and I have included "Closes
#{bug_report_issue_number}" in the PR description.
- [ ] The bug was found by the module author, and no one has opened an
issue to report it yet.
- [ ] Feature update backwards compatible feature updates, and I have
bumped the MINOR version in `version.json`.
- [ ] Breaking changes and I have bumped the MAJOR version in
`version.json`.
  - [ ] Update to documentation
  • Loading branch information
AlexanderSehr authored May 9, 2024
1 parent 47b4880 commit f86e359
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,18 @@ function Get-ResourceIdsAsFormattedObjectList {

switch ($idElements.Count) {
{ $PSItem -eq 5 } {
if ($idElements[3] -eq 'managementGroups') {
if ($idElements[2] -eq 'Microsoft.Management' -and $idElements[3] -eq 'managementGroups') {
# management-group level management group (e.g. '/providers/Microsoft.Management/managementGroups/testMG')
$formattedResources += @{
resourceId = $resourceId
type = $idElements[2, 3] -join '/'
}
} elseif ($idElements[2] -eq 'Microsoft.Subscription' -and $idElements[3] -eq 'aliases') {
# management-group level subscription alias (e.g., '/providers/Microsoft.Subscription/aliases/testSub')
$formattedResources += @{
resourceId = $resourceId
type = 'Microsoft.Subscription/aliases'
}
} else {
# subscription level resource group (e.g. '/subscriptions/<subId>/resourceGroups/myRG')
$formattedResources += @{
Expand Down

0 comments on commit f86e359

Please sign in to comment.