Cost Management – How to Automate Cost Analysis Reports in Azure

The cost analysis is one of the crucial activities while working on any Azure application. As Azure services involve some cost so an organization (small or big) should have an automatic mechanism to download reports on a schedule basis, review, and analyze it to understand the insights about expenses.

Cost Management has a Cost Analysis feature using that cost reports can be scheduled and generate. Cost Analysis provides four options to schedule an export report, and these are –

  1. Daily export of month-to-date costs
  2. Weekly export of last 7 days
  3. Monthly export of last month’s cost
  4. One-time export

Now, we will create four types of reports and generate the CSVs. Export only supports CSV format, but if needed to transform data into a different formats like JSON etc., then Azure Data Factory can be leverage.

Create Schedules

Login to Azure Portal and create a general purpose V2 storage account to export the reports in CSV format.

Storage Account

Once the storage account is ready, then do a global search for Cost Management + Billing and select it, then from the left side pane select Cost Management.

1. Select Cost Analysis

Now, change the scope to Azure Subscription by clicking on the Scope. This step is needed because this will decide what would get extracted.

2. Select Scope

Once the scope has been added to calculate the cost analysis, then click on the download option from the main screen and click on View All Export. It will open the cost management export window. 

3. View All Export

Now, the next step is to create an export schedule, and to do that click on the “Add” option and perform the below steps

  1. Enter the report name DailyReport to create Daily export of Month-to-Date report.
  2. Select the Azure subscription and storage account <demosacostanalysis>.
  3. Give container name as reports and directory as daily. The container name and directory names could be of your choice.
  4. Click on the Create.
4. Create Daily Report

Similarly, create the other three types of reports based on the options available in Export type. Now, exports screen would have four types of scheduled exports.

Use weekly, monthly, and custom as directory name input respectively. 

5. Export Schedules

Now, scheduled exports have been created successfully, and we want to see the output. If you don’t want to wait for the execution, then select All reports and click on the Run now.


Once all the runs have been completed, then the storage account <demosacostanalysis> must have all reports in their respective directory inside the container reports.

6. Storage Account Reports Folder

Go inside “daily” folder and see the generated CSV file.

7. Daily Report Output

In the same way, go inside the other report folders and verify the output csv file.

This implementation has done at an Azure Subscription level, but cost analysis can also be done at a resource group level because every resource group has cost analysis option under cost management settings.

So, we have seen how cost analysis scheduled exports can be configured and generate the reports based on our requirements. 🙂

One thought on “Cost Management – How to Automate Cost Analysis Reports in Azure

Add yours

Leave a Reply

Up ↑

%d bloggers like this: