I'm new here and I have a question about this access problem. I create an app from my Azure AD, this app I used for read the costs of billings account, I use this API query usage: https://learn.microsoft.com/es-es/rest/api/cost-management/query/usage?tabs=HTTP#billingaccountquerygrouping-legacy
When I send this request:
https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{{billing_account}}/providers/Microsoft.CostManagement/query?api-version=2023-03-01
I have this response:
{
"error": {
"code": "RBACAccessDenied",
"message": "The client does not have authorization to perform action. Request ID: 98c2999a-5964-483f-b8d6-3f2a024fe915"
}
}
From my billing account I add the access to my app, the access I add is: Cost management reader and Cost management contributor, but the problem persist and I not find a solution for this, I need your help.
I change the roles and access permissions from the access control (Iam) from my billing account but the problem persists.
I followed the steps below to get the solution Verify that your application has been added to Azure Active Directory (AD) and that you have the required client credentials (client ID and client secret).

Go to the Azure portal and navigate to your billing account.Click on "Access control (IAM)" and verify that your app's service principal or managed identity has the "Cost Management Reader" or "Cost Management Contributor" role assigned at the billing account level.
6.Check RBAC Permissions:If the problem still occurs, check the RBAC permissions at various levels: Permissions for applications in Azure AD: Check to see if the registered application has the requisite access rights to the Cost Management API.Check the application's registration to make sure the proper roles have been assigned at the subscription level and resource group level: Verify that the registered application has the proper roles allocated at the level of the resource group if your billing account is a part of that resource group.