Azure / Azure/azure-powershell

Get-AzConsumptionUsageDetail -- MeterDetails.PretaxStandardRate and PretaxCost always empty

Open
#21,639 3 comments 0 reactions 0 assignees View on GitHub
act-codegen-extensibility-squad Consumption - Billing needs-team-attention question Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description

While trying to run `Get-AzConsumptionUsageDetail` against a subscription, with either `-Expand MeterDetails` or `-IncludeMeterDetails` flags, I am finding that MeterDetails.PretaxStandardRate is always null and PretaxCost is always zero (0).

Are there additional permissions needed to get this information? Running against a Visual Studio sub at least shows the PretaxCost, an EA sub always shows 0.

### Script or Debug output

```PowerShell
Get-AzConsumptionUsageDetail -StartDate 4/22/2023 -EndDate 4/23/2023 -Expand MeterDetails | ConvertTo-Json

{
"AccountName": null,
"AdditionalInfo": null,
"AdditionalProperties": null,
"BillableQuantity": null,
"BillingPeriodId": "/subscriptions/XXXX7F20-XXXX-XXXX-XXXX-XXXX894B4321/providers/Microsoft.Billing/billingPeriods/202305",
"BillingPeriodName": "202305",
"ConsumedService": "Microsoft.Sql",
"CostCenter": null,
"Currency": "USD",
"DepartmentName": null,
"Id": "/subscriptions/XXXX7F20-XXXX-XXXX-XXXX-XXXX894B43211/providers/Microsoft.Billing/billingPeriods/202305/providers/Microsoft.Consumption/usageDetails/a413565f-8b30-43c2-7cc8-193a1efd253c",
"InstanceId": "/subscriptions/XXXX7F20-XXXX-XXXX-XXXX-XXXX894B4321/resourceGroups/deleteme-rg/providers/Microsoft.Sql/servers/authtestdb/databases/",
"InstanceLocation": "US East",
"InstanceName": "testingdb",
"InvoiceId": null,
"InvoiceName": null,
"IsEstimated": false,
"MeterDetails": {
"MeterName": "B DTU",
"MeterCategory": "SQL Database",
"MeterSubCategory": "Single Basic",
"Unit": "10 /Day",
"MeterLocation": "US East",
"TotalIncludedQuantity": null,
"PretaxStandardRate": null
},
"MeterId": "cae64797-9ecf-4906-b517-6238c80c045f",
"Name": "a413565f-8b30-43c2-7cc8-193a1efd253c",
"PretaxCost": 0.161,
"Product": "",
"SubscriptionGuid": "XXXX7F20-XXXX-XXXX-XXXX-XXXX894B4321",
"SubscriptionName": "XXXX",
"Tags": null,
"Type": "Microsoft.Consumption/usageDetails",
"UsageEnd": "2023-04-23T23:59:59Z",
"UsageQuantity": 1.0,
"UsageStart": "2023-04-23T00:00:00Z"
},
```

### Environment data

```PowerShell
Name Value
---- -----
PSVersion 7.3.4
PSEdition Core
GitCommitId 7.3.4
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```

### Module versions

```PowerShell
oduleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.10.1 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script 2.0.0 Az.Billing {Get-AzBillingAccount, Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzBillingProfile…}
Script 0.3.1 Az.CostManagement {Get-AzCostManagementExport, Get-AzCostManagementExportExecutionHistory, Invoke-AzCostManagementExecuteExport, Invoke-AzCostManagementQuery…}
Script 6.2.0 Az.Resources {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment…}
Script 4.9.0 Az.Storage {Add-AzRmStorageContainerLegalHold, Add-AzStorageAccountManagementPolicyAction, Add-AzStorageAccountNetworkRule, Close-AzStorageFileHandle…}
```

### 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.