How to send Azure costs and usage data to log analytics workspace or directly to azure metrics?

1.3k Views Asked by At

I need to build a dashboard which will visuallize the usage and cost of many azure subscriptions. accounts, departments. My plan was:

  1. Send the data that is 'behind' the Azure Cost Analysis view, to the log analytics workspace.
  2. In the log analytics workspace, perform custom aggregations / filters.
  3. Display those aggregations as charts in Azure Metrics or directly in Azure Dashboard.

Problem is with step 1, I dont know how to send the data that is 'behind' the Azure Cost Analysis view, to the log analytics workspace. I thought of two solutions:

  1. Fetching the data from azure cost & billing API.
  2. Schedule Export cost analysis data to a storage account, and then somehow moving the data from the storage account to the log analytics workspace.

Both solutions seems to me a bit 'overkilling' - is there a more direct approach to send the cost analysis data to log analytics workspace? If there is no option such as that, I would be happy to know how would you suggest moving the exported data from the storage account to the log analytics, or do you have some other idea?

Thank you!

2

There are 2 best solutions below

0
On

I believe a direct approach is currently not available but I see this feature request raised in UserVoice / feedback forum for the same requirement. If interested, you may upvote it because in general the responsible Azure product / feature team would triage / start checking feasibility and prioritizing a received feedback based on various factors like number of votes a feedback receives, feasibility, open prioritized backlog items, etc.

I would suggest you to fetch the data from azure cost & billing API and send that data to Log Analytics from a REST API client by using the HTTP Data Collector API. For more information and illustration with examples, refer this Azure document. Or else if you want to fetch the data from azure cost & billing API and store it in a machine then you may go with custom logs. For more information w.r.t it, refer this Azure document.

Other related references:

0
On

The only native solution is, to schedule from the Costs-Blade an export of the Costs as CSV into a StorageAccount. If you want to load the Data into a Log-Analytics-Workspace, Azure Automation and a scheduled Script would work.