Comments (18)
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.
from azure-cost-cli.
My subscription infos:
{
"authorizationSource": "Legacy",
"displayName": "XXX",
"id": "/subscriptions/YYY",
"state": "Enabled",
"subscriptionId": "YYY",
"subscriptionPolicies": {
"locationPlacementId": "Public_2014-09-01",
"quotaId": "Sponsored_2016-01-01",
"spendingLimit": "Off"
}
}
from azure-cost-cli.
I pushed a fix/workaround for this in v0.15
from azure-cost-cli.
Hi @mivano and thanks for the update!
Now the error is this one Error: Sequence contains no elements
:
Version: 0.4.0.0
No subscription ID specified. Trying to retrieve the default subscription ID from Azure CLI.
Default subscription ID retrieved from az cli: [subid]
Token retrieved and expires at: 09/05/2023 07:31:48 +00:00
Retrieving data from
/subscriptions/[subid]/providers/Microsoft.CostManagement/query?api-version=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
Error: Sequence contains no elements
from azure-cost-cli.
According to the debug output, it does not even call the forecast API. Got this every time? Also on the costByResource command?
from azure-cost-cli.
Yes, I get this error even now, after some hours from the first try. (accumulatedCost
, does the same)
With the costByResource
the error is this:
fbonizzi@MacBook-Air-di-Francesco ~ % azure-cost costByResource --debug
Version: 0.4.0.0
No subscription ID specified. Trying to retrieve the default subscription ID
from Azure CLI.
Default subscription ID retrieved from az cli:
[subId]
Using token credential: ChainedTokenCredential to fetch a token.
Token retrieved and expires at: 09/05/2023 11:21:36 +00:00
Retrieving data from
/subscriptions/[subId]/providers/Microsoft.CostMana
gement/query?api-version=2021-10-01&$top=5000 using the following payload:
{
"type": "ActualCost",
"timeframe": "BillingMonthToDate",
"timePeriod": null,
"dataSet": {
"granularity": "None",
"aggregation": {
"totalCost": {
"name": "Cost",
"function": "Sum"
},
"totalCostUSD": {
"name": "CostUSD",
"function": "Sum"
}
},
"include": [
"Tags"
],
"grouping": [
{
"type": "Dimension",
"name": "ResourceId"
},
{
"type": "Dimension",
"name": "ResourceType"
},
{
"type": "Dimension",
"name": "ResourceLocation"
},
{
"type": "Dimension",
"name": "ChargeType"
},
{
"type": "Dimension",
"name": "ResourceGroupName"
},
{
"type": "Dimension",
"name": "PublisherType"
},
{
"type": "Dimension",
"name": "ServiceName"
},
{
"type": "Dimension",
"name": "ServiceTier"
},
{
"type": "Dimension",
"name": "Meter"
}
]
}
}
Response status code is BadRequest and got payload size of 903
Response content: {"error":{"code":"BadRequest","message":"Invalid query
definition: Invalid dataset grouping: 'ServiceTier'; valid values:
'ResourceGroup','ResourceGroupName','ResourceType','ResourceId','ResourceLocatio
n','SubscriptionId','SubscriptionName','MeterCategory','MeterSubcategory','Meter
','ServiceFamily','UnitOfMeasure','PartNumber','BillingAccountName','BillingProf
ileId','BillingProfileName','InvoiceSection','InvoiceSectionId','InvoiceSectionN
ame','Product','ResourceGuid','ChargeType','ServiceName','ProductOrderId','Produ
ctOrderName','PublisherType','ReservationId','ReservationName','Frequency','Invo
iceId','PricingModel','CostAllocationRuleName','MarkupRuleName','BillingMonth','
Provider','BenefitId','BenefitName','CustomerTenantId','CustomerTenantDomainName
','ResellerMPNId','PartnerEarnedCreditApplied','CustomerName','PartnerName',''.\
r\n\r\n (Request ID: 0c81c26c-9250-4407-a5c4-1f2777cd13e0)"}}
from azure-cost-cli.
@mivano If I can do something to help with this, please tell me 😆
from azure-cost-cli.
Sorry not having been able to fix this properly. I cannot reproduce this on my subscriptions.
Just to be clear; the ServiceTier grouping is only for the costByResource. Do the other calls work for you? I do not understand why the ServiceTier is not retrievable. This contains useful information about SKU and type of cost (like table, files, network)
from azure-cost-cli.
No problem, let's try the other methods:
By calling azure-cost accumulatedCost --debug
, I got:
Version: 0.23.0.0
No subscription ID specified. Trying to retrieve the default subscription ID
from Azure CLI.
Default subscription ID retrieved from az cli:
[subId]
Using token credential: ChainedTokenCredential to fetch a token.
Token retrieved and expires at: 11/06/2023 16:03:03 +00:00
Retrieving data from
/subscriptions/[subId]/?api-version=2019-11-01
using the following payload:
null
Response status code is OK and got payload size of 388
Retrieved subscription details:
{
"id": "/subscriptions/[subId]",
"authorizationSource": "Legacy",
"managedByTenants": [
],
"subscriptionId": "[subId]",
"tenantId": "1dc02703-20bf-42d8-8622-75e8d168dbb8",
"displayName": "[subName]",
"state": "Enabled",
"subscriptionPolicies": {
"locationPlacementId": "Public_2014-09-01",
"quotaId": "Sponsored_2016-01-01",
"spendingLimit": "Off"
}
}
Retrieving data from
/subscriptions/[subId]/providers/Microsoft.CostMana
gement/query?api-version=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"
}
},
"filter": null,
"sorting": [
{
"direction": "Ascending",
"name": "UsageDate"
}
]
}
}
Response status code is OK and got payload size of 455
Retrieving data from
/subscriptions/[subId]/providers/Microsoft.CostMana
gement/forecast?api-version=2021-10-01&$top=5000 using the following payload:
{
"type": "ActualCost",
"timeframe": "Custom",
"timePeriod": {
"from": "2023-06-01",
"to": "2023-06-30"
},
"dataSet": {
"granularity": "Daily",
"aggregation": {
"totalCost": {
"name": "Cost",
"function": "Sum"
}
},
"filter": null,
"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"}}
System.Net.Http.HttpRequestException: Response status code does not indicate
success: 424 (Failed Dependency).
at HttpResponseMessage System.Net.Http.HttpResponseMessage.
EnsureSuccessStatusCode()
at async Task<HttpResponseMessage> AzureCostCli.CostApi.AzureCostApiRetriever.
ExecuteCallToCostApi(bool includeDebugOutput, object payload, Uri uri) in
/home/runner/work/azure-cost-cli/azure-cost-cli/src/CostApi/
AzureCostApiRetriever.cs:163
at async Task<IEnumerable<CostItem>>
AzureCostCli.CostApi.AzureCostApiRetriever.RetrieveForecastedCosts(bool
includeDebugOutput, Guid subscriptionId, string[] filter, TimeframeType
timeFrame, DateOnly from, DateOnly to) in
/home/runner/work/azure-cost-cli/azure-cost-cli/src/CostApi/
AzureCostApiRetriever.cs:612
Ignoring this exception, as it is not supported for all subscriptions.
Retrieving data from
/subscriptions/[subId]/providers/Microsoft.CostMana
gement/query?api-version=2021-10-01&$top=5000 using the following payload:
{
"type": "ActualCost",
"timeframe": "BillingMonthToDate",
"timePeriod": null,
"dataSet": {
"granularity": "None",
"aggregation": {
"totalCost": {
"name": "Cost",
"function": "Sum"
},
"totalCostUSD": {
"name": "CostUSD",
"function": "Sum"
}
},
"sorting": [
{
"direction": "Ascending",
"name": "UsageDate"
}
],
"grouping": [
{
"type": "Dimension",
"name": "ServiceName"
}
],
"filter": null
}
}
Response status code is OK and got payload size of 457
Retrieving data from
/subscriptions/[subId]/providers/Microsoft.CostMana
gement/query?api-version=2021-10-01&$top=5000 using the following payload:
{
"type": "ActualCost",
"timeframe": "BillingMonthToDate",
"timePeriod": null,
"dataSet": {
"granularity": "None",
"aggregation": {
"totalCost": {
"name": "Cost",
"function": "Sum"
},
"totalCostUSD": {
"name": "CostUSD",
"function": "Sum"
}
},
"sorting": [
{
"direction": "Ascending",
"name": "UsageDate"
}
],
"grouping": [
{
"type": "Dimension",
"name": "ResourceLocation"
}
],
"filter": null
}
}
Response status code is OK and got payload size of 462
Retrieving data from
/subscriptions/[subId]/providers/Microsoft.CostMana
gement/query?api-version=2021-10-01&$top=5000 using the following payload:
{
"type": "ActualCost",
"timeframe": "BillingMonthToDate",
"timePeriod": null,
"dataSet": {
"granularity": "None",
"aggregation": {
"totalCost": {
"name": "Cost",
"function": "Sum"
},
"totalCostUSD": {
"name": "CostUSD",
"function": "Sum"
}
},
"sorting": [
{
"direction": "Ascending",
"name": "UsageDate"
}
],
"grouping": [
{
"type": "Dimension",
"name": "ResourceGroupName"
},
{
"type": "Dimension",
"name": "ChargeType"
}
],
"filter": null
}
}
}
Response status code is OK and got payload size of 501
Error: Sequence contains no elements
from azure-cost-cli.
By calling azure-cost budgets --debug
, I get:
Version: 0.23.0.0
No subscription ID specified. Trying to retrieve the default subscription ID
from Azure CLI.
Default subscription ID retrieved from az cli:
[subId]
Using token credential: ChainedTokenCredential to fetch a token.
Token retrieved and expires at: 11/06/2023 16:03:03 +00:00
Retrieving data from
/subscriptions/[subId]/providers/Microsoft.Consumpt
ion/budgets/?api-version=2021-10-01 using the following payload:
null
Response status code is BadRequest and got payload size of 253
Response content: {"error":{"code":"400","message":"Cost Management supports
only Enterprise Agreement, Web direct and Microsoft Customer Agreement offer
types. offerId: MS-AZR-0036P is associated with offerType: None (Request ID:
8d354889-ee54-46e8-a50f-7f2f80331b4a)"}}
Error: Response status code does not indicate success: 400 (Bad Request).
from azure-cost-cli.
azure-cost dailyCosts --debug
Version: 0.23.0.0
No subscription ID specified. Trying to retrieve the default subscription ID
from Azure CLI.
Default subscription ID retrieved from az cli:
[subId]
Using token credential: ChainedTokenCredential to fetch a token.
Token retrieved and expires at: 11/06/2023 16:03:03 +00:00
Retrieving data from
/subscriptions/[subId]/?api-version=2019-11-01
using the following payload:
null
Response status code is OK and got payload size of 388
Retrieved subscription details:
{
"id": "/subscriptions/[subId]",
"authorizationSource": "Legacy",
"managedByTenants": [
],
"subscriptionId": "[subId]",
"tenantId": "1dc02703-20bf-42d8-8622-75e8d168dbb8",
"displayName": "[subName]",
"state": "Enabled",
"subscriptionPolicies": {
"locationPlacementId": "Public_2014-09-01",
"quotaId": "Sponsored_2016-01-01",
"spendingLimit": "Off"
}
}
Retrieving data from
/subscriptions/[subId]/providers/Microsoft.CostMana
gement/query?api-version=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"
}
],
"grouping": [
{
"type": "Dimension",
"name": "ResourceGroupName"
},
{
"type": "Dimension",
"name": "ChargeType"
}
],
"filter": null
}
}
from azure-cost-cli.
That Sponsored_2016-01-01 is still somewhere an issue. Thanks for the traces, I will try to see what I can dig up!
from azure-cost-cli.
Thanks a lot! 🚀
from azure-cost-cli.
The 0.29.0 release will hopefully solve the servicetier issue (when you try to fetch the cost for resources).
from azure-cost-cli.
Hi and thanks!
I confirm that there are no errors, but the result is empty!
azure-cost costByResource --debug
Version: 0.30.0.0
No subscription ID specified. Trying to retrieve the default subscription ID
from Azure CLI.
Default subscription ID retrieved from az cli:
[subid]
Using token credential: ChainedTokenCredential to fetch a token.
Token retrieved and expires at: 09/07/2023 07:33:05 +00:00
Retrieving data from
/subscriptions/[subid]/providers/Microsoft.CostMana
gement/query?api-version=2021-10-01&$top=5000 using the following payload:
{
"type": "ActualCost", resources...
"timeframe": "BillingMonthToDate",
"timePeriod": null,
"dataSet": {
"granularity": "None",
"aggregation": {
"totalCost": {
"name": "Cost",
"function": "Sum"
},
"totalCostUSD": {
"name": "CostUSD",
"function": "Sum"
}
},
"include": [
"Tags"
],
"filter": null,
"grouping": [
{
"type": "Dimension",
"name": "ResourceId"
},
{
"type": "Dimension",
"name": "ResourceType"
},
{
"type": "Dimension",
"name": "ResourceLocation"
},
{
"type": "Dimension",
"name": "ChargeType"
},
{
"type": "Dimension",
"name": "ResourceGroupName"
},
{
"type": "Dimension",
"name": "PublisherType"
},
{
"type": "Dimension",
"name": "MeterCategory"
},
{
"type": "Dimension",
"name": "MeterSubcategory"
},
{
"type": "Dimension",
"name": "Meter"
}
]
}
}
Response status code is OK and got payload size of 813
Cost by resources
It ends like this:
from azure-cost-cli.
Is this the same subscription as listed in your first post? So a Sponsored_2016-01-01
type? If so, then this is an unsupported quota id according to this list: https://learn.microsoft.com/en-us/azure/cost-management-billing/costs/understand-cost-mgt-data#supported-microsoft-azure-offers
from azure-cost-cli.
Yes, the same. Ok, so we are done. 🙈
from azure-cost-cli.
The good news is that when we will finish the sponsorship bonus, we will go back with a normal subscription so I will be able to use your wonderful tool. 🤣
from azure-cost-cli.
Related Issues (20)
- Report "dailyCost" by period. HOT 4
- Exclude when filtering HOT 3
- Monthly issue metrics report
- Accessing Government Cloud (High) HOT 15
- timeframe TheLastMonth error HOT 5
- Error when running the command azure-cost dailyCosts -b locally HOT 1
- .net framework 6.0 ? HOT 11
- Monthly issue metrics report
- incorrect value for accumulatedCost report Last 30 days: HOT 2
- incorrect time span for accumulatedCost report last 7 days cost includes 8 days in range HOT 4
- Monthly issue metrics report
- getting 400 error HOT 3
- The grain Hourly not works HOT 3
- Piping the output to a file hides actual errors HOT 3
- Monthly issue metrics report
- Bug - Missing subscription ID. Please specify a subscription ID or login to Azure CLI HOT 2
- Monthly issue metrics report
- Feature request: - -o json should just be json HOT 7
- Response status code does not indicate success: 401 (Unauthorized) HOT 3
- Monthly issue metrics report
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-cost-cli.