Azure / Azure/azure-powershell

New-AzCostManagementDetailReport returns CreateExpanded error when scoped to Management Group

Open
#21,203 8 comments 1 reaction 1 assignee Claimed by @LucasYao93 View on GitHub
bug Cost Management - UsageDetailsAndExport customer-reported Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description

Running the New-AzCostManagementDetailReport command and assigning a scope of a management group, as per

`New-AzCostManagementDetailReport -Scope "providers/Microsoft.Management/managementGroups/MG" -Metric 'ActualCost' -BillingPeriod "202302"`

Throws the following error:

`"New-AzCostManagementDetailReport_CreateExpanded: Expected '{' or '['. Was String: The."`

Not sure if intended, as the previous command of New-AzCostManagementExport can handle scope of Management Group.

Looks like it could be an issue with the function 'New-AzCostManagementDetailReport' within [/src/CostManagement/exports/New-AzCostManagementDetailReport.ps1](https://github.com/Azure/azure-powershell/blob/4a96b1bc4859a157ccdfb0ba729b898e5680251b/src/CostManagement/exports/New-AzCostManagementDetailReport.ps1)

### Issue script & Debug output

```PowerShell
New-AzCostManagementDetailReport -Scope "providers/Microsoft.Management/managementGroups/MG" -Metric 'ActualCost' -BillingPeriod "202302"

"New-AzCostManagementDetailReport_CreateExpanded: Expected '{' or '['. Was String: The."
```

### Environment data

```PowerShell
Name Value
---- -----
PSVersion 7.3.2
PSEdition Core
GitCommitId 7.3.2
OS Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:42:11 PST 2023; root:xnu-8792.81.3~2/RELEASE_X86_64
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```

### Module versions

```PowerShell
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.9.1 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script 0.3.0 Az.CostManagement {Get-AzCostManagementExport, Get-AzCostManagementExportExecutionHistory, Invoke-AzCostManageme…
```

### Error output

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.