Azure Cost Management API - not getting the same results in Azure Workbooks

Salma SBOUI 0 Reputation points
2023-10-10T09:57:29.5633333+00:00

Hi,

I am using the Azure Cost Management API : '/subscriptions/{Subscription:subscriptionid}/providers/Microsoft.CostManagement/query?' to get daily Databricks jobs costs using jobid argument in my request in Azure Workbook. ( {Subscription:subscriptionid} is a parameter set in the workbook).

I have an 'Application' dropdown parameter that represents jobid values for each application, represented by a json:

[
	{  	
	"value": [jobid1, jobid2, jobid3], "label":"App1" 
}, 
	{   
	"value": [jobid1, jobid2, jobid3] , "label": "App2" 
}
]

This is the body of my request :

{
   "type": "Usage",
   "timeframe": "MonthToDate",
   "dataset": {
     "granularity": "Daily",
     "filter": {
                 "tags" : {
                     "name" : "jobid",
                     "operator" : "In",
                     "values" : {Application:escapejson}
                 }
     },
     "aggregation": { "totalCost": {"name": "Cost","function": "Sum"}},
     "grouping": [
       {
         "type": "TagKey",
         "name": "jobid"
       }
     ]
   }

The problem is that i am not getting the same results as the ones in Azure Cost Management Analysis service, where I filter by the same jobids for each view (app).

Thank you

Azure Cost Management
Azure Cost Management
A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.
2,130 questions
{count} votes