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

"Billing Accounts - List" returns empty list for api version 2020-05-01 #4364

Open
2 of 9 tasks
RaniLinkov opened this issue Apr 3, 2024 · 1 comment
Open
2 of 9 tasks
Assignees
Labels
customer-reported question Further information is requested

Comments

@RaniLinkov
Copy link

Link to sample

https://learn.microsoft.com/en-us/rest/api/billing/billing-accounts/list?view=rest-billing-2020-05-01&viewFallbackFrom=rest-billing-2021-10-01

Library name and version

com.azure.resourcemanager:azure-resourcemanager-billing:1.0.0-beta.3

Language of the Sample

  • C#/.NET
  • Java
  • JavaScript/TypedScript
  • Python
  • Golang
  • Other - Please specify in Issue details field

Sample Issue Type

  • Sample not working
  • Sample missing
  • Do not understand sample

Issue details

Getting empty billing account list when using api version 2020-05-01, both using REST and the billing sdk.

Able to retrieve account list using version 2019-10-01-preview.

Expected behavior

Expecting to get billing account list when using sdk method and\or HTTP endpoint

Actual behavior

Getting empty billing account list

Reproduction Steps

TokenCredential credential = new ClientSecretCredentialBuilder().clientId(credentials.getClientId())
                                                                            .clientSecret(credentials.getClientSecret())
                                                                            .tenantId(credentials.getTenantId())
                                                                            .build();

            AzureProfile profile = new AzureProfile(credentials.getTenantId(), null, AzureEnvironment.AZURE);

            BillingManager billingManager = BillingManager.authenticate(credential, profile);

            retVal = billingManager.billingAccounts().list().stream().collect(Collectors.toList());

Environment

Java 8 dropwizard

@XiaofeiCao
Copy link

XiaofeiCao commented Jul 8, 2024

Hi @RaniLinkov , this may be due to lack of permission. See Azure/azure-rest-api-specs#21580 (comment)

2019-10-01-preview might not enforce permission on reading while 2020-05 might have.
Would you try adding sufficient role/permission to your service principal and try again?(Billing Reader role may not be enough, you may need Account Administrator role as the comment above implies)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants