Azure / Azure/azure-powershell

Update-AzCostManagementExport: Invalid request payload, Invalid member :properties.schedule.recurrence

Open
#27,730 1 comment 0 reactions 0 assignees View on GitHub
bug Cost Management - UsageDetailsAndExport Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
3d 14h
Merged PRs (30d)
54

Description

### Description

I have a cost export working until around May 6th, that when using Update-AzCostManagementExport to update its start and end time it throws error
Invalid request payload, Invalid member :properties.schedule.recurrence

Cmd tried:

1.
Update-AzCostManagementExport -Scope "/subscriptions/$azSubId" -Name $exportName -TimePeriodFrom $startDate -TimePeriodTo $endDate -DefinitionTimeframe "Custom" -ScheduleStatus "InActive" -Format "CSV" -DefinitionType "Usage" -DatasetGranularity "Daily" -RecurrencePeriodTo (Get-Date) -RecurrencePeriodFrom (Get-Date) -ErrorAction Stop

2.
Update-AzCostManagementExport -Scope "/subscriptions/$azSubId" -Name $exportName -TimePeriodFrom $startDate -TimePeriodTo $endDate -DefinitionTimeframe "Custom" -ScheduleStatus "InActive" -Format "CSV" -DefinitionType "Usage" -DatasetGranularity "Daily" -ErrorAction Stop

### Issue script & Debug output

```PowerShell
PS C:\Users\> $DebugPreference='Continue'
PS C:\Users\> Update-AzCostManagementExport -Scope "/subscriptions/$azSubId" -Name $exportName -TimePeriodFrom $startDate -TimePeriodTo $endDate -DefinitionTimeframe "Custom" -ScheduleStatus "InActive" -Format "CSV" -DefinitionType "Usage" -DatasetGranularity "Daily" -RecurrencePeriodTo (Get-Date) -RecurrencePeriodFrom (Get-Date) -ErrorAction Stop
DEBUG: 10:00:12 AM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:00:12 AM - GetAzureRMContextCommand begin processing with ParameterSet 'GetSingleContext'.
DEBUG: 10:00:12 AM - [ConfigManager] Got [False] from [DisplayBreakingChangeWarning], Module = [Az.Accounts], Cmdlet = [Get-AzContext].
DEBUG: 10:00:12 AM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:00:12 AM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:00:12 AM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:00:12 AM - No authentication telemetry is found for the current cmdlet with Id f4371ca7-0ca1-4685-beed-d606901ca701.
DEBUG: AzureQoSEvent: Module: Az.Accounts:4.2.0; CommandName: Get-AzContext; PSVersion: 7.5.1; IsSuccess: True; Duration: 00:00:00.0016659; SanitizeDuration: 00:00:00.0000518
DEBUG: 10:00:12 AM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:00:13 AM - GetAzureRMContextCommand end processing.
DEBUG: 10:00:13 AM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:00:13 AM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:00:13 AM - GetAzureRMContextCommand begin processing with ParameterSet 'GetSingleContext'.
DEBUG: 10:00:13 AM - [ConfigManager] Got [False] from [DisplayBreakingChangeWarning], Module = [Az.Accounts], Cmdlet = [Get-AzContext].
DEBUG: 10:00:13 AM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:00:13 AM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:00:13 AM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:00:13 AM - GetAzureRMContextCommand end processing.
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing:
DEBUG: CmdletProcessRecordStart:
DEBUG: CmdletGetPipeline:
DEBUG: CmdletBeforeAPICall:
DEBUG: URLCreated: //subscriptions//providers/Microsoft.CostManagement/exports/a830edad9050849stxprod0120b_sharepoint_com?api-version=2021-10-01
DEBUG: RequestCreated: //subscriptions//providers/Microsoft.CostManagement/exports/a830edad9050849stxprod0120b_sharepoint_com?api-version=2021-10-01
DEBUG: HeaderParametersAdded:
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com//subscriptions//providers/Microsoft.CostManagement/exports/a830edad9050849stxprod0120b_sharepoint_com?api-version=2021-10-01

Headers:
x-ms-unique-id : 8
x-ms-client-request-id : f8df3926-d35e-484f-ac10-2abb391322f1
CommandName : Get-AzCostManagementExport
FullCommandName : Get-AzCostManagementExport_Get
ParameterSetName : __AllParameterSets
User-Agent : AzurePowershell/v0.0.0,PSVersion/v7.5.1,Az.CostManagement/0.1.0

Body:

DEBUG: BeforeCall:
DEBUG: 10:00:13 AM - [ConfigManager] Got nothing from [DisableInstanceDiscovery], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: 10:00:13 AM - [ConfigManager] Got [False] from [EnableLoginByWam], Module = [], Cmdlet = [].
DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
OK

Headers:
Cache-Control : no-cache
Pragma : no-cache
Vary : Accept-Encoding
session-id : b2d454ce-7722-4308-9347-9bac72529e82
x-ms-request-id : 38087b7b-ff59-4c38-a65d-8a649be2a800
x-ms-correlation-id : 3a28c083-3b6a-496d-a465-8a19387ca4b7
x-ms-correlation-request-id : 6417eea4-0f64-402f-9cac-1008e465d9f4
x-ms-client-request-id : f8df3926-d35e-484f-ac10-2abb391322f1
X-Powered-By : ASP.NET
x-ms-operation-identifier : tenantId=3c39752e-0592-48db-912f-c54b4552eefe,objectId=18020e8e-c521-4bc4-8d8a-14db25a4faa0/westus2/2851b60b-1531-4ab1-90e6-acebe702955a
x-ms-ratelimit-remaining-subscription-reads: 249
x-ms-ratelimit-remaining-subscription-global-reads: 3749
x-ms-routing-request-id : WESTUS2:20250511T170017Z:6417eea4-0f64-402f-9cac-1008e465d9f4
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
X-Cache : CONFIG_NOCACHE
X-MSEdge-Ref : Ref A: 7373C16915E942A99F2A547BC918F160 Ref B: MWH011020806052 Ref C: 2025-05-11T17:00:16Z
Date : Sun, 11 May 2025 17:00:16 GMT

Body:
{
"id": "subscriptions//providers/Microsoft.CostManagement/exports/a830edad9050849stxprod0120b_sharepoint_com",
"name": "a830edad9050849stxprod0120b_sharepoint_com",
"type": "Microsoft.CostManagement/exports",
"eTag": "\"1dbbde31cbbe959\"",
"properties": {
"schedule": {
"status": "Inactive",
"recurrencePeriod": {
"from": "2025-05-05T17:28:22.8907407Z",
"to": "2025-05-05T17:28:22.8906513Z"
}
},
"format": "Csv",
"deliveryInfo": {
"destination": {
"resourceId": "/subscriptions//resourceGroups/CostExportAutomationRG/providers/Microsoft.Storage/storageAccounts/costexpsa20240913",
"container": "automationcontainer",
"rootFolderPath": "costexport"
}
},
"definition": {
"type": "Usage",
"timeframe": "Custom",
"timePeriod": {
"from": "2025-04-03T00:00:00Z",
"to": "2025-05-05T00:00:00Z"
},
"dataSet": {
"granularity": "Daily"
}
}
}
}

DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:
DEBUG: Finally:
DEBUG: CmdletAfterAPICall:
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd:
DEBUG: CmdletProcessRecordEnd:
DEBUG: 10:00:13 AM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing:
DEBUG: CmdletProcessRecordStart:
DEBUG: CmdletGetPipeline:
DEBUG: CmdletBeforeAPICall:
DEBUG: URLCreated: //subscriptions//providers/Microsoft.CostManagement/exports/a830edad9050849stxprod0120b_sharepoint_com?api-version=2021-10-01
DEBUG: RequestCreated: //subscriptions//providers/Microsoft.CostManagement/exports/a830edad9050849stxprod0120b_sharepoint_com?api-version=2021-10-01
DEBUG: HeaderParametersAdded:
DEBUG: BodyContentSet:
DEBUG: 10:00:13 AM - [ConfigManager] Got nothing from [DisableInstanceDiscovery], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PUT

Absolute Uri:
https://management.azure.com//subscriptions//providers/Microsoft.CostManagement/exports/a830edad9050849stxprod0120b_sharepoint_com?api-version=2021-10-01

Headers:
x-ms-unique-id : 9
x-ms-client-request-id : f76f1aeb-5b91-4c9f-8778-c28e7a8283f5
CommandName : Az.CostManagement.internal\Update-AzCostManagementExport
FullCommandName : Update-AzCostManagementExport_UpdateExpanded
ParameterSetName : __AllParameterSets
User-Agent : AzurePowershell/v0.0.0,PSVersion/v7.5.1,Az.CostManagement/0.1.0

Body:
{
"eTag": "\"1dbbde31cbbe959\"",
"properties": {
"deliveryInfo": {
"destination": {
"resourceId": "/subscriptions//resourceGroups/CostExportAutomationRG/providers/Microsoft.Storage/storageAccounts/costexpsa20240913",
"container": "automationcontainer",
"rootFolderPath": "costexport",
"sasToken": "",
"storageAccount": ""
}
},
"definition": {
"timePeriod": {
"from": "2025-04-09T00:00:00",
"to": "2025-05-11T00:00:00"
},
"dataSet": {
"granularity": "Daily"
},
"type": "Usage",
"timeframe": "Custom"
},
"format": "CSV",
"partitionData": false,
"schedule": {
"recurrencePeriod": {
"from": "2025-05-11T10:00:12.9816626-07:00",
"to": "2025-05-11T10:00:12.9815716-07:00"
},
"status": "InActive",
"recurrence": ""
}
}
}

DEBUG: 10:00:13 AM - [ConfigManager] Got [False] from [EnableLoginByWam], Module = [], Cmdlet = [].
DEBUG: BeforeCall:
DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Cache-Control : no-cache
Pragma : no-cache
session-id : 9f858fe6-977a-4b91-826b-90989e29526c
x-ms-request-id : 99ef4ac5-cf4e-4f90-b55a-aaa088c90215
x-ms-correlation-id : 9c932afb-1948-4af3-a4ac-55ca3550b805
X-Powered-By : ASP.NET
x-ms-operation-identifier : tenantId=3c39752e-0592-48db-912f-c54b4552eefe,objectId=18020e8e-c521-4bc4-8d8a-14db25a4faa0/westus/42274643-13dd-4c34-b7a1-5f07d8ffbf6e
x-ms-ratelimit-remaining-subscription-reads: 249
x-ms-ratelimit-remaining-subscription-global-reads: 3749
x-ms-correlation-request-id : 97cec2df-d938-4f09-8dd2-a6fa061fe288
x-ms-routing-request-id : WESTUS:20250511T170017Z:97cec2df-d938-4f09-8dd2-a6fa061fe288
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
X-Cache : CONFIG_NOCACHE
X-MSEdge-Ref : Ref A: 9560F2C51D064C4D9940AD8B49090412 Ref B: MWH011020806052 Ref C: 2025-05-11T17:00:17Z
Date : Sun, 11 May 2025 17:00:17 GMT

Body:
{
"error": {
"code": "400",
"message": "Invalid request payload, Invalid member :properties.schedule.recurrence"
}
}

DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:
DEBUG: CmdletProcessRecordEnd:
Update-AzCostManagementExport_UpdateExpanded: C:\Users\\OneDrive - Microsoft\Documents\PowerShell\Modules\Az.CostManagement\0.4.0\CostManagement.Autorest\custom\Update-AzCostManagementExport.ps1:375
Line |
375 | … Az.CostManagement.internal\Update-AzCostManagementExport …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Invalid request payload, Invalid member :properties.schedule.recurrence
```

### Environment data

```PowerShell
Name Value
---- -----
PSVersion 7.5.1
PSEdition Core
GitCommitId 7.5.1
OS Microsoft Windows 10.0.26100
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
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 4.2.0 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script 0.4.0 Az.CostManagement {Get-AzCostManagementExport, Get-AzCostManagementExportExecutionHistory, Invoke-AzCostManagementExecuteExport, Invoke-AzCostManagementQuery…}
Script 7.11.0 Az.Resources {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment…}
Script 8.4.0 Az.Storage {Add-AzRmStorageContainerLegalHold, Add-AzStorageAccountManagementPolicyAction, Add-AzStorageAccountNetworkRule, Close-AzStorageFileHandle…}
```

### Error output

```PowerShell
DEBUG: 10:06:18 AM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:06:18 AM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 10:06:18 AM - using account id 'syntex@m365x33941147.onmicrosoft.com'...
DEBUG: 10:06:18 AM - [ConfigManager] Got [False] from [DisplayBreakingChangeWarning], Module = [Az.Accounts], Cmdlet = [Resolve-AzError].
DEBUG: 10:06:18 AM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].

HistoryId: 53

Message : [400] : Invalid request payload, Invalid member :properties.schedule.recurrence
StackTrace :
Exception : System.Exception
InvocationInfo : {Update-AzCostManagementExport_UpdateExpanded}
Line : Az.CostManagement.internal\Update-AzCostManagementExport @PSBoundParameters

Position : At C:\Users\qishengc\OneDrive - Microsoft\Documents\PowerShell\Modules\Az.CostManagement\0.4.0\CostManagement.Autorest\custom\Update-AzCostManagementExport.ps1:375 char:17
+ … Az.CostManagement.internal\Update-AzCostManagementExport …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 53

DEBUG: 10:06:19 AM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].

HistoryId: 51

Message : [400] : Invalid request payload, Invalid member :properties.schedule.recurrence
StackTrace :
Exception : System.Exception
InvocationInfo : {Update-AzCostManagementExport_UpdateExpanded}
Line : Az.CostManagement.internal\Update-AzCostManagementExport @PSBoundParameters

Position : At C:\Users\qishengc\OneDrive - Microsoft\Documents\PowerShell\Modules\Az.CostManagement\0.4.0\CostManagement.Autorest\custom\Update-AzCostManagementExport.ps1:375 char:17
+ … Az.CostManagement.internal\Update-AzCostManagementExport …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 51

DEBUG: 10:06:19 AM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].

HistoryId: 50

Message : [400] : Invalid request payload, Invalid member :properties.schedule.recurrence
StackTrace :
Exception : System.Exception
InvocationInfo : {Update-AzCostManagementExport_UpdateExpanded}
Line : Az.CostManagement.internal\Update-AzCostManagementExport @PSBoundParameters

Position : At C:\Users\qishengc\OneDrive - Microsoft\Documents\PowerShell\Modules\Az.CostManagement\0.4.0\CostManagement.Autorest\custom\Update-AzCostManagementExport.ps1:375 char:17
+ … Az.CostManagement.internal\Update-AzCostManagementExport …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 50

DEBUG: 10:06:19 AM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].

HistoryId: 49

Message : [400] : Invalid request payload, Invalid member :properties.schedule.recurrence
StackTrace :
Exception : System.Exception
InvocationInfo : {Update-AzCostManagementExport_UpdateExpanded}
Line : Az.CostManagement.internal\Update-AzCostManagementExport @PSBoundParameters

Position : At C:\Users\qishengc\OneDrive - Microsoft\Documents\PowerShell\Modules\Az.CostManagement\0.4.0\CostManagement.Autorest\custom\Update-AzCostManagementExport.ps1:375 char:17
+ … Az.CostManagement.internal\Update-AzCostManagementExport …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 49
```

Contributor guide

Open the contributing guide

Research direction

Start with the Update-AzCostManagementExport entry point and the generated CostManagement.Autorest/custom/Update-AzCostManagementExport.ps1 line 375 mentioned in the error. Reproduce the PUT request using the issue's command and debug payload, then inspect how the schedule fields are serialized. Done means updating the export succeeds without the invalid properties.schedule.recurrence member error.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, powershell
Domain
cli, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.