Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource group scope does not work as documented #38660

Open
AndrewGailer opened this issue Sep 10, 2019 · 15 comments
Open

Resource group scope does not work as documented #38660

AndrewGailer opened this issue Sep 10, 2019 · 15 comments

Comments

@AndrewGailer
Copy link

AndrewGailer commented Sep 10, 2019

When using the Usage Details - List REST API, specifying a scope with a resource group returns a 404 - File or directory not found error.

The documentation says to specify the scope as /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName} but this returns the 404 error.

As a workaround, you can specify the resource group in the filter like $filter=properties/resourceGroup eq '{resourceGroupName}'; however, this does not work with the latest version of the API (2019-05-01).
If you specify the filter, the following error is returned:

{
    "error": {
        "code": "400",
        "message": "Billing Period is not supported in (2019-05-01) API Version for Subscription Scope With Web Direct Offer. (Request ID: adf9d616-cc8f-48c9-84eb-8fa59d528170)"
    }
}

Changing the API version to the previous stable release (2019-01-01) allows the filter to work.
This is an example of the full URI: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/usageDetails?api-version=2019-05-01&$filter=properties/resourceGroup eq 'dev-rg'

Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ID: 77db9ac7-6b1c-496b-36a3-24119c897546
Version Independent ID: 31fbb3ed-1eb8-ff0c-05d8-1e92ccc1519f
Content: Azure consumption API overview
Content Source: articles/billing/billing-consumption-api-overview.md
Service: billing
GitHub Login: @bandersmsft
Microsoft Alias: banders

@KrishnaG-MSFT
Copy link
Contributor

@AndrewGailer Thanks for the comment. This feedback has been shared with @bandersmsft for further review.

@prajyot2909
Copy link

I am also facing the same issue do we have any resolution on the above question ?

Copy link

ClintFrancis commented Jan 29, 2020

I'm getting the same error when making a call to the Usage Details List with the 2019-10-01 API:

https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/usageDetails?api-version=2019-10-01

Results in the error:

{"code":"400","message":"Billing Period is not supported in (2019-10-01) API Version for Subscription Scope With Web Direct Offer. (Request ID: 69e0e402-d3fd-49a3-b7d8-728f272aa51d)"}

Making the same call using the 2019-01-01 API is successful, but is not in line with the documentation and is missing fields (resourceGroup etc).

Any resolution?

@josch83
Copy link

josch83 commented May 27, 2020

@bandersmsft Are there any news on this issue? It still returns "Billing Period is not supported in (2019-11-01) API Version for Subscription Scope With Web Direct Offer. (Request ID: 69fda2f6-f14b-4202-8b6e-6f906a1d9a8b)" for subscription-based scopes. Even worse, the previously usable api-version "2019-01-01" started to return an empty array only.
Edit: The api-version "2019-01-01" now again delivers content (seems that there was just a temporary unavailability).

@muad81
Copy link

muad81 commented Jun 2, 2020

Same issue here : Billing Period is not supported in (2019-10-01) API Version for Subscription Scope.
Latest working version at Subscription scope is 2019-01-01. Is there any ways to query this last version?

@yaegashi
Copy link

I got the same error with go-autorest for https://management.azure.com/subscriptions/XXXXXXXX/providers/Microsoft.Consumption/usageDetails?&api-version=2019-10-01:

consumption.UsageDetailsClient#List: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="400" Message="Billing Period is not supported in (2019-10-01) API Version for Subscription Scope With Web Direct Offer. Please provide the UsageStart and UsageEnd dates in the $filter key as parameters. (Request ID: adcd9582-23c2-4d11-a53c-698b4a4845b8)"

I didn't provide any billing periods in the request. And how can I provide UsageStart and UsageEnd dates for usagedetails?

@yaegashi
Copy link

It worked with the following query: $filter=properties/usageStart eq '2020-06-01' and properties/usageEnd eq '2020-06-30' as seen in Azure/azure-sdk-for-go#2399 (comment)

https://management.azure.com/subscriptions/XXXXXXXX/providers/Microsoft.Consumption/usageDetails?%24expand=properties%2FadditionalInfo%2Cproperties%2FmeterDetails&%24filter=properties%2FusageStart+eq+%272020-06-01%27+and+properties%2FusageEnd+eq+%272020-06-30%27&api-version=2019-10-01

The doc should be updated to mention the correct $filter spec for Web Direct Offer.

@bandersmsft
Copy link
Member

@KrishnaG-MSFT This issue doesn't directly affect the article published to https://docs.microsoft.com/azure/cost-management-billing/manage/consumption-api-overview

This appears to be a bug with https://docs.microsoft.com/rest/api/consumption/usagedetails/list and that's maintained by the engineering team. Can please reassign as a product bug, not a doc issue? Thanks.

@Tom331
Copy link

Tom331 commented Jul 28, 2020

Hi @bandersmsft, is there a workaround or an ETA on the product bug fix? I am having a similar issue with the usageDetails endpoint, specifically i cannot filter on tags in the $filter parameter. Stack overflow question with the problem I'm having

@KrishnaG-MSFT
Copy link
Contributor

Unable to add @prkumarms-zz in assignees so tagging @prkumarms-zz for visibility, review and to help provide insights.

@PcChip
Copy link

PcChip commented Aug 3, 2020

Hello,

I'm having the same error message with Az consumption usage list, I cannot pull any usage info
Azure/azure-powershell#10203

@Tom331
Copy link

Tom331 commented Aug 3, 2020

@PcChip Hey, i found a workaround. If you check out the comment i made in my stack overflow post it may help:

https://stackoverflow.com/questions/63125218/azure-usagedetails-rest-api-cannot-filter-on-tags

@ankur198
Copy link

apparently adding quotes in the filter fixes the issue

not working:
costmanagement_client.usage_details.list( scope=f'/subscriptions/{subscription_id}/', filter=f"properties/usageEnd eq {end_date} and properties/usageStart eq {start_date}")

working:
costmanagement_client.usage_details.list( scope=f'/subscriptions/{subscription_id}/', filter=f"properties/usageEnd eq '{end_date}' and properties/usageStart eq '{start_date}'")

@DeBlackDragon
Copy link

Still don´t working within newer api-versions. Just 2019-01-01 seems to acceppt the parameters.
@ankur198
also tried the qoutes around the parameters but makes no difference

@doruchiulan
Copy link

doruchiulan commented Nov 22, 2022

Having issues too, trying to use tags in combination with startDate/endDate does not work, giving always empty result

https://management.azure.com/subscriptions/{{subscriptionId}}/providers/Microsoft.Consumption/usageDetails?api-version=2021-10-01&$filter=tags eq 'vendor:databricks' and properties/usageStart ge '2022-11-01' and properties/usageEnd le '2022-11-10'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests