Azure / Azure/azure-powershell
New-AZCostManagementDetailReport does not return when report completed
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 51
Description
### Description
New-AZCostManagementDetailReport never returns but continues to poll every 30 seconds after the report is completed.
### Issue script & Debug output
```PowerShell
PS E:\Temp> New-AZCostManagementDetailReport -Scope "subscriptions/9af2fe58-e215-4e90-8595-XXXXXXXXXXXX" -Metric 'ActualCost' -BillingPeriod 202301
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing:
DEBUG: CmdletProcessRecordStart:
DEBUG: CmdletGetPipeline:
DEBUG: CmdletBeforeAPICall:
DEBUG: URLCreated: /subscriptions/9af2fe58-e215-4e90-8595-XXXXXXXXXXXX/providers/Microsoft.CostManagement/generateCostDetailsReport?api-version=2022-05-01
DEBUG: RequestCreated: /subscriptions/9af2fe58-e215-4e90-8595-XXXXXXXXXXXX/providers/Microsoft.CostManagement/generateCostDetailsReport?api-version=2022-05-01
DEBUG: HeaderParametersAdded:
DEBUG: BodyContentSet:
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
POST
Absolute Uri:
https://management.azure.com/subscriptions/9af2fe58-e215-4e90-8595-XXXXXXXXXXXX/providers/Microsoft.CostManagement/generateCostDetailsReport?api-version=2022-05-01
Headers:
x-ms-unique-id : 1
x-ms-client-request-id : eaa37d1e-0d45-400e-bb5c-5794c42984d6
CommandName : New-AZCostManagementDetailReport
FullCommandName : New-AzCostManagementDetailReport_CreateExpanded
ParameterSetName : __AllParameterSets
User-Agent : AzurePowershell/v0.0.0,PSVersion/v5.1.17763.3770,Az.CostManagement/0.3.0
Body:
{
"metric": "ActualCost",
"billingPeriod": "202301"
}
DEBUG: BeforeCall:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
Accepted
Headers:
Pragma : no-cache
Retry-After : 20
session-id : ce508b06-8b3b-43ac-9f80-5518d192b5ec
x-ms-request-id : d8c78083-a2d6-4d32-84e9-88b73830cb86
OData-EntityId : 7b00d46e-dc02-4464-829f-f9ac72e9606f
x-ms-correlation-request-id : 44463ed0-a40c-4628-bf85-6a06a98d93bf
x-ms-client-request-id : eaa37d1e-0d45-400e-bb5c-5794c42984d6
x-ms-ratelimit-microsoft.costmanagement-scope-request-remaining-per-day: 47
x-ms-ratelimit-microsoft.costmanagement-scope-request-remaining-per-hour: 9
x-ms-ratelimit-microsoft.costmanagement-tenant-request-remaining-per-min: 10
x-ms-ratelimit-microsoft.costmanagement-scope-request-remaining-per-min: 2
x-ms-ratelimit-remaining-subscription-reads: 11924
x-ms-routing-request-id : CENTRALUS:20230214T151936Z:44463ed0-a40c-4628-bf85-6a06a98d93bf
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
Cache-Control : no-cache
Date : Tue, 14 Feb 2023 15:19:36 GMT
Location :
https://management.azure.com/subscriptions/9af2fe58-e215-4e90-8595-XXXXXXXXXXXX/providers/Microsoft.CostManagement/costDetailsOperationResults/7b00d46e-dc02-4464-829f-f9ac72e9606f?api-version=2022-05-01
X-Powered-By : ASP.NET
Body:
DEBUG: ResponseCreated:
DEBUG: DelayBeforePolling: Delaying 20 seconds before polling.
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://management.azure.com/subscriptions/9af2fe58-e215-4e90-8595-XXXXXXXXXXXX/providers/Microsoft.CostManagement/costDetailsOperationResults/7b00d46e-dc02-4464-829f-f9ac72e9606f?api-version=2022-05-01
Headers:
x-ms-unique-id : 2
x-ms-client-request-id : eaa37d1e-0d45-400e-bb5c-5794c42984d6
CommandName : New-AZCostManagementDetailReport
FullCommandName : New-AzCostManagementDetailReport_CreateExpanded
ParameterSetName : __AllParameterSets
User-Agent : AzurePowershell/v0.0.0,PSVersion/v5.1.17763.3770,Az.CostManagement/0.3.0
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Pragma : no-cache
Vary : Accept-Encoding
session-id : a64ad04b-91f1-4169-b42f-4f056acbc95c
x-ms-request-id : 62e992cb-318f-418d-ade9-145b53728013
x-ms-correlation-request-id : cc6d8a69-bfea-49a3-9831-d301403d7d5e
x-ms-client-request-id : eaa37d1e-0d45-400e-bb5c-5794c42984d6
x-ms-ratelimit-remaining-subscription-reads: 11923
x-ms-routing-request-id : CENTRALUS:20230214T151957Z:cc6d8a69-bfea-49a3-9831-d301403d7d5e
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
Cache-Control : no-cache
Date : Tue, 14 Feb 2023 15:19:56 GMT
X-Powered-By : ASP.NET
Body:
{
"id": "/subscriptions/9af2fe58-e215-4e90-8595-XXXXXXXXXXXX/providers/Microsoft.CostManagement/costDetailsOperationResults/7b00d46e-dc02-4464-829f-f9ac72e9606f",
"name": "7b00d46e-dc02-4464-829f-f9ac72e9606f",
"status": "Completed",
"manifest": {
"manifestVersion": "2022-05-01",
"dataFormat": "Csv",
"byteCount": 92008511,
"blobCount": 1,
"compressData": false,
"requestContext": {
"requestScope": "/subscriptions/9af2fe58-e215-4e90-8595-XXXXXXXXXXXX/",
"requestBody": {
"metric": "ActualCost",
"invoiceId": null,
"billingPeriod": "202301"
}
},
"blobs": [
{
"blobLink":
"https://ccmreportstoragenortheu3.blob.core.windows.net/armreports/20230214/7b00d46e-dc02-4464-829f-f9ac72e9606f?sv=2016-05-31&sr=b&sig=XXXXXXXXXXvxm9z2%2BConrSSwq8GnwQpN53P0vxUVTdDmU%3D&spr=https&st=2023-02-14T15%3A14%3
A57Z&se=2023-02-15T03%3A19%3A57Z&sp=r",
"byteCount": 92008511
}
]
},
"validTill": "2023-02-15T03:19:57.4923235Z"
}
DEBUG: Polling:
DEBUG: DelayBeforePolling: Delaying 30 seconds before polling.
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://management.azure.com/subscriptions/9af2fe58-e215-4e90-8595-XXXXXXXXXXXX/providers/Microsoft.CostManagement/costDetailsOperationResults/7b00d46e-dc02-4464-829f-f9ac72e9606f?api-version=2022-05-01
Headers:
x-ms-unique-id : 3
x-ms-client-request-id : eaa37d1e-0d45-400e-bb5c-5794c42984d6
CommandName : New-AZCostManagementDetailReport
FullCommandName : New-AzCostManagementDetailReport_CreateExpanded
ParameterSetName : __AllParameterSets
User-Agent : AzurePowershell/v0.0.0,PSVersion/v5.1.17763.3770,Az.CostManagement/0.3.0
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Pragma : no-cache
Vary : Accept-Encoding
session-id : 0ca17d1f-b322-4baf-aace-90773fa2e3d0
x-ms-request-id : 3deab2e8-7f1b-4f32-9bb3-48b18f60da98
x-ms-correlation-request-id : ca664c49-c1b1-4938-96f8-137de60ed933
x-ms-client-request-id : eaa37d1e-0d45-400e-bb5c-5794c42984d6
x-ms-ratelimit-remaining-subscription-reads: 11922
x-ms-routing-request-id : CENTRALUS:20230214T152028Z:ca664c49-c1b1-4938-96f8-137de60ed933
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
Cache-Control : no-cache
Date : Tue, 14 Feb 2023 15:20:27 GMT
X-Powered-By : ASP.NET
Body:
{
"id": "/subscriptions/9af2fe58-e215-4e90-8595-XXXXXXXXXXXX/providers/Microsoft.CostManagement/costDetailsOperationResults/7b00d46e-dc02-4464-829f-f9ac72e9606f",
"name": "7b00d46e-dc02-4464-829f-f9ac72e9606f",
"status": "Completed",
"manifest": {
"manifestVersion": "2022-05-01",
"dataFormat": "Csv",
"byteCount": 92008511,
"blobCount": 1,
"compressData": false,
"requestContext": {
"requestScope": "/subscriptions/9af2fe58-e215-4e90-8595-XXXXXXXXXXXX/",
"requestBody": {
"metric": "ActualCost",
"invoiceId": null,
"billingPeriod": "202301"
}
},
"blobs": [
{
"blobLink":
"https://ccmreportstoragenortheu3.blob.core.windows.net/armreports/20230214/7b00d46e-dc02-4464-829f-f9ac72e9606f?sv=2016-05-31&sr=b&sig=XXXXXXXXXXrc1V6zN1tsV9cDcbEeialitxGD%2B%2B0nI2w%3D&spr=https&st=2023-02-14T15%3A15%3
A28Z&se=2023-02-15T03%3A20%3A28Z&sp=r",
"byteCount": 92008511
}
]
},
"validTill": "2023-02-15T03:20:28.1051443Z"
}
DEBUG: Polling:
DEBUG: DelayBeforePolling: Delaying 30 seconds before polling.
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://management.azure.com/subscriptions/9af2fe58-e215-4e90-8595-XXXXXXXXXXXX/providers/Microsoft.CostManagement/costDetailsOperationResults/7b00d46e-dc02-4464-829f-f9ac72e9606f?api-version=2022-05-01
Headers:
x-ms-unique-id : 4
x-ms-client-request-id : eaa37d1e-0d45-400e-bb5c-5794c42984d6
CommandName : New-AZCostManagementDetailReport
FullCommandName : New-AzCostManagementDetailReport_CreateExpanded
ParameterSetName : __AllParameterSets
User-Agent : AzurePowershell/v0.0.0,PSVersion/v5.1.17763.3770,Az.CostManagement/0.3.0
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Pragma : no-cache
Vary : Accept-Encoding
session-id : fec4c6c7-9a99-4db4-8350-03b0f7ff0fdf
x-ms-request-id : dd061e79-fd7c-4474-9c2b-d020a63b370b
x-ms-correlation-request-id : bd998863-cdec-411f-a98b-bbf1e7827f0c
x-ms-client-request-id : eaa37d1e-0d45-400e-bb5c-5794c42984d6
x-ms-ratelimit-remaining-subscription-reads: 11921
x-ms-routing-request-id : CENTRALUS:20230214T152058Z:bd998863-cdec-411f-a98b-bbf1e7827f0c
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
Cache-Control : no-cache
Date : Tue, 14 Feb 2023 15:20:58 GMT
X-Powered-By : ASP.NET
Body:
{
"id": "/subscriptions/9af2fe58-e215-4e90-8595-XXXXXXXXXXXX/providers/Microsoft.CostManagement/costDetailsOperationResults/7b00d46e-dc02-4464-829f-f9ac72e9606f",
"name": "7b00d46e-dc02-4464-829f-f9ac72e9606f",
"status": "Completed",
"manifest": {
"manifestVersion": "2022-05-01",
"dataFormat": "Csv",
"byteCount": 92008511,
"blobCount": 1,
"compressData": false,
"requestContext": {
"requestScope": "/subscriptions/9af2fe58-e215-4e90-8595-XXXXXXXXXXXX/",
"requestBody": {
"metric": "ActualCost",
"invoiceId": null,
"billingPeriod": "202301"
}
},
"blobs": [
{
"blobLink":
"https://ccmreportstoragenortheu3.blob.core.windows.net/armreports/20230214/7b00d46e-dc02-4464-829f-f9ac72e9606f?sv=2016-05-31&sr=b&sig=XXXXXXXXXXWLnnBDOzkYibnhU2R7wgcLgUyDi6B7epk%3D&spr=https&st=2023-02-14T15%3A15%3A58Z
&se=2023-02-15T03%3A20%3A58Z&sp=r",
"byteCount": 92008511
}
]
},
"validTill": "2023-02-15T03:20:58.8150825Z"
}
DEBUG: Polling:
DEBUG: DelayBeforePolling: Delaying 30 seconds before polling.
```
### Environment data
```PowerShell
PS E:\Temp> $PSVERSIONTABLE
Name Value
---- -----
PSVersion 5.1.17763.3770
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.3770
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```
### Module versions
```PowerShell
PS E:\Temp> Get-Module Az*
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 2.11.2 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault...}
Script 0.3.0 Az.CostManagement {Get-AzCostManagementExport, Get-AzCostManagementExportExecutionHistory, Invoke-AzCostManagementExecuteExport, Invoke-AzCostManagementQuery...}
```
### Error output
```PowerShell
PS E:\Temp> Resolve-AzError
DEBUG: 10:29:17 - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 10:29:17 - using account id 'MY@QUALIFIED.ACCOUNT.NAME'...
DEBUG: 10:29:17 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
WARNING: Upcoming breaking changes in the cmdlet 'Resolve-AzError' :
The `Resolve-Error` alias will be removed in a future release. Please change any scripts that use this alias to use `Resolve-AzError` instead.
Note : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.
DEBUG: AzureQoSEvent: Module: Az.Accounts:2.11.2; CommandName: Resolve-AzError; PSVersion: 5.1.17763.3770; IsSuccess: True; Duration: 00:00:00.0188817
DEBUG: 10:29:17 - [ConfigManager] Got [True] from [EnableDataCollection], Module = [], Cmdlet = [].
DEBUG: 10:29:17 - ResolveError end processing.
```
Contributor guide
Assessment
This issue has not been assessed yet.