Scheduling execution date and time in "az costmanagement export" command

Pitawat 351 Reputation points
2024-11-07T10:11:46.25+00:00

My company uses Azure under MCA agreement and has many billing profiles. I scheduled Azure usage file export job for each billing profile with az costmanagement export create command to have it run monthly but the job never ran at the time I expected.

This is the parameters that I included in the command

--storage-container "exports" --timeframe "TheLastMonth" --recurrence "Monthly" --schedule-status "Active" --type "ActualCost" --storage-directory "mydir" --recurrence-period from="2024-11-06T01:00:00Z" to="2050-02-01T01:00:00Z"

I assumed that it would run on --recurrence-period from timestamp so I set it to 2024-11-06T01:00:00Z which is 6 Nov 1AM UTC. This would be 8AM UTC+7 in my time zone. But it actually ran at 7 Nov 3:20 AM UTC+7. One full day and 2 hours later than what I intended.

Microsoft's documentation doesn't mention anything about scheduling the execution time. Is this even possible? Did I make any mistake in my command? What timestamp should I use to schedule it to run in the morning of the 6th of every month?

Thanks.

Azure Cost Management
Azure Cost Management
A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.
2,688 questions
Azure
Azure
A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
1,018 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Alistair Ross 7,136 Reputation points Microsoft Employee
    2024-11-07T10:54:32.13+00:00

    Hello @Pitawat

    A lot of the documentation for things like Azure CLI, Rest API and PowerShell are generated via a script. In my experience, it's always best to look at the documentation for the product itself, not just the command line references.

    With regards to your scheduled export issue, it is detailed here and has examples relating to your scenario. https://video2.skills-academy.com/en-us/azure/cost-management-billing/costs/tutorial-export-acm-data?tabs=azure-portal#export-schedule

    "Scheduled exports get affected by the time and day of week of when you initially create the export. When you create a scheduled export, the export runs at the same frequency for each export that runs later. For example, the export runs during once each UTC day for a daily export of month-to-date costs export set at a daily frequency. Similarly for a weekly export, the export runs every week on the same UTC day as it is scheduled. Individual export runs can occur at different times throughout the day. So, avoid taking a firm dependency on the exact time of the export runs. Run timing depends on the active load present in Azure during a given UTC day. When an export run begins, your data should be available within 4 hours."

    I hope this clarifies things

    kind regards

    Alistair

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.