Skip to content

Commit 11af0b5

Browse files
Bug - Invoke-AzCostManagementQuery cmdlet should handle null value in the response rows (#21180)
* Fix the issue for Invoke-AzCostManagementQuery cmdlet response might have null value in the response rows. * Update Changelog.md * Update Changelog.md --------- Co-authored-by: Yabo Hu <[email protected]>
1 parent d5a4126 commit 11af0b5

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/CostManagement/Changelog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
* Overview of change #1
1818
- Additional information about change #1
1919
-->
20+
2021
## Upcoming Release
22+
* Fixed an error that values in row could be null when grouping by the value of TagKey in Invoke-AzCostManagementQuery cmdlet.
2123

2224
## Version 0.3.0
2325
* Upgraded Api version to 2021-10-01
@@ -27,4 +29,3 @@
2729

2830
## Version 0.1.0
2931
* First preview release for module Az.CostManagement
30-

src/CostManagement/custom/Invoke-AzCostManagementQuery.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,11 @@ function Invoke-AzCostManagementUsageQueryInternal {
265265
foreach ($Row in $ResponseContent.Properties.Rows) {
266266
$QueryRow = New-Object System.Collections.Generic.List[string]
267267
foreach ($Item in $Row) {
268-
$QueryRow.Add($Item.ToString())
268+
if ($null -eq $Item) {
269+
$QueryRow.Add($Item)
270+
} else {
271+
$QueryRow.Add($Item.ToString())
272+
}
269273
}
270274
$RowList.Add($QueryRow)
271275
}

0 commit comments

Comments
 (0)