Skip to content

Commit

Permalink
fix: Fix 'n/a' resource id handing in resource type counting (#397)
Browse files Browse the repository at this point in the history
  • Loading branch information
tksh164 authored Sep 18, 2024
1 parent 43b5f5a commit 9efec1b
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions tools/3_wara_reports_generator.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,22 @@ $Global:Runtime = Measure-Command -Expression {
{
if (![string]::IsNullOrEmpty($ID))
{
$obj = @{
'ID' = $ID;
'Subscription' = $ID.split('/')[2];
'Resource Group' = $ID.split('/')[4];
'Resource Type' = ($ID.split('/')[6] + '/' + $ID.split('/')[7])
if ($ID -eq 'n/a') {
# Need special care for the recommendation 4e133bd0-8762-bc40-a95b-b29142427d73 because it returns 'n/a' as resource IDs.
$obj = @{
'ID' = $ID
'Subscription' = 'n/a'
'Resource Group' = 'n/a'
'Resource Type' = 'Microsoft.Network/networkWatchers'
}
}
else {
$obj = @{
'ID' = $ID;
'Subscription' = $ID.split('/')[2];
'Resource Group' = $ID.split('/')[4];
'Resource Type' = ($ID.split('/')[6] + '/' + $ID.split('/')[7])
}
}
$Resources += $obj
}
Expand Down

0 comments on commit 9efec1b

Please sign in to comment.