using arm-consumption sdk with billingAccountId give 401
See original GitHub issue-
Package Name: @azure/arm-consumption
-
Package Version: 9.0.1
-
Operating system:
-
nodejs
- 14
-
typescript
-
Is the bug related to documentation in
- README.md
- source code documentation
- [ x ] SDK API docs on https://github.com/Azure/azure-sdk-for-js/tree/aee346be5458df5c81e53dbb09e1a7f3a7b07e1a/sdk/consumption/arm-consumption
Describe the bug When using arm-consumption all request with
const billingAccountId = "123456";
we experiance a 401 answer. We have assigned the role reader on the whole EA portal for the app registration we using.
RestError: No claims present for the caller in the system { "name": "RestError", "code": "401", "statusCode": 401, "request": { "url": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/XXXXX/billingPeriods/202204/providers/Microsoft.Consumption/balances?api-version=2021-10-01", "headers": { "accept": "application/json", "accept-encoding": "gzip,deflate", "user-agent": "azsdk-js-arm-consumption/9.0.1 core-rest-pipeline/1.8.0 Node/v14.19.0 OS/(x64-Darwin-21.3.0)", "x-ms-client-request-id": "xxxxx-xxxx-xxx-xxx-xxxxxxxx", "authorization": "REDACTED" }, "method": "GET", "timeout": 0, "disableKeepAlive": false, "streamResponseStatusCodes": {}, "withCredentials": false, "requestId": "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx", "allowInsecureConnection": false, "enableBrowserStreams": false }, "details": { "error": { "code": "401", "message": "No claims present for the caller in the system" } }, "message": "No claims present for the caller in the system"
We are using the example in: https://github.com/Azure/azure-sdk-for-js/blob/aee346be5458df5c81e53dbb09e1a7f3a7b07e1a/sdk/consumption/arm-consumption/samples/v9/typescript/src/balancesGetByBillingAccountSample.ts
And authenticate using @identity sdk.
To Reproduce Steps to reproduce the behavior:
- Resgister an application in Azure Portal
- Download the example from sdk example https://github.com/Azure/azure-sdk-for-js/blob/aee346be5458df5c81e53dbb09e1a7f3a7b07e1a/sdk/consumption/arm-consumption/samples/v9/typescript/src/balancesGetByBillingAccountSample.ts
- Add the tenant, app id and secreat to the project/azure function using the sdk
- Give the app reader in the EA portal
- Make the request with billingAccountId
Expected behavior Getting balancesGetByBillingAccountSample response as expected in example.
Issue Analytics
- State:
- Created a year ago
- Comments:11 (5 by maintainers)
@BoostSebastian, Look like this is a service backend error that related with your billing account. I tried on my side, get another 404 error.
I guess this is because my offer type doesn’t support this. but not very sure. Maybe you can try to open a support ticket in the portal to get the help from the service team directly. FYI here’s their FAQ https://docs.microsoft.com/en-us/azure/cost-management-billing/cost-management-billing-faq?WT.mc_id=Portal-Microsoft_Azure_Support&product=all
Yes, I will take a look. Thanks