REST API で 登録アカウントの課金情報が取得できない
三雲 勇二
1
Reputation point
こんにちは。
下記のドキュメントのとおりに curl でテストしたのですが、登録アカウントの課金をAPIから取得できません。
https://video2.skills-academy.com/ja-jp/azure/cost-management-billing/manage/review-enterprise-billing
サブスクリプション内のリソース一覧の取得テストはできたので、Bearer の問題ではなさそうです。
他に見るべきドキュメントはありますでしょうか?
---
[調査内容]
登録アカウントの課金の取得テスト → NG
https://video2.skills-academy.com/ja-jp/azure/cost-management-billing/manage/review-enterprise-billing
( {} には実際に取得したものが入るが割愛)
billingAccounts
sh
curl -X GET -H "Authorization: Bearer {bearer}" -H "Content-Type: application/json" https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/usageDetails?api-version=2018-06-30
エラーレスポンス
json
{
"error": {
"code": "401",
"message": "User does not have the required permissions to access all objects. (Request ID: {})"
}
}
enrollmentAccounts
sh
curl -X GET -H "Authorization: Bearer {bearer}" -H "Content-Type: application/json" https://management.azure.com/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}/providers/Microsoft.Consumption/usageDetails?api-version=2018-06-30
エラーレスポンス
json
{
"error": {
"code": "500",
"message": "An exception occurred during processing the request. Use this request id '{謎のID}' for follow-up."
}
}
サブスクリプション内のリソース一覧の取得テスト → OK
(つまり Bearer の問題ではなさそう)
sh
curl -X GET -H "Authorization: Bearer {bearer}" -H "Content-Type: application/json" https://management.azure.com/subscriptions/{subscriptionid}/resources?api-version=2019-10-01