azure-cost-cli: API returns `424 Failed dependency`

          To me the error now is `424 Failed dependency`
Version: 0.4.0.0
Using token credential: ChainedTokenCredential to fetch a token.
Token retrieved and expires at: 18/04/2023 16:02:25 +00:00
Retrieving data from 
/subscriptions/[subId]/providers/Microsoft.CostManagement/query?api-versio
n=2021-10-01&$top=5000 using the following payload:
{
   "type": "ActualCost",
   "timeframe": "BillingMonthToDate",
   "timePeriod": null,
   "dataSet": {
      "granularity": "Daily",
      "aggregation": {
         "totalCost": {
            "name": "Cost",
            "function": "Sum"
         },
         "totalCostUSD": {
            "name": "CostUSD",
            "function": "Sum"
         }
      },
      "sorting": [
         {
            "direction": "Ascending",
            "name": "UsageDate"
         }
      ]
   }
}
Response status code is OK and got payload size of 455
Retrieving data from 
/subscriptions/[subId]/providers/Microsoft.CostManagement/forecast?api-ver
sion=2021-10-01&$top=5000 using the following payload:
{
   "type": "ActualCost",
   "timeframe": "Custom",
   "timePeriod": {
      "from": "2023-04-18",
      "to": "2023-05-02"
   },
   "dataSet": {
      "granularity": "Daily",
      "aggregation": {
         "totalCost": {
            "name": "Cost",
            "function": "Sum"
         }
      },
      "sorting": [
         {
            "direction": "ascending",
            "name": "UsageDate"
         }
      ]
   }
}
Response status code is FailedDependency and got payload size of 97
Response content: {"error":{"code":"FailedDependency","message":"Can't do forecast - cost training data
is empty"}}

Hi @mivano! I didn’t understand if this kind of error is going to be solved or if is it impossible to make ti work with my kind of subscription because of API design. Thanks!

_Originally posted by @FrancescoBonizzi in https://github.com/mivano/azure-cost-cli/issues/6#issuecomment-1513274282_

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 18 (7 by maintainers)

Most upvoted comments

Hopefully, MS will move more types to the new cost API soon. Unfortunately, the previous error obscured that it simply did not had any data.