0

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.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

1 Answers1

0

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). enter image description here enter image description here

  1. Go to the Azure portal and navigate to your App Registration. Make sure the necessary rights are granted under "API permissions." The "Cost Management Reader" and "Cost Management Contributor" responsibilities ought to be assigned in this situation..

enter image description here

  1. Check Access Control (IAM) for Billing Account:

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.

enter image description here

  1. API Request verification: Make sure to substitute the real billing account ID or name for "billing_account" in the API request URL.Verify that the Cost Management API supports the API version that was supplied in the request (api-version=2023-03-01).
  2. Validate Authentication: If you're utilizing the client credentials (client ID and client secret) of your registered application, make sure you're acquiring an access token appropriately. If you're utilizing the "Bearer" authentication technique, make sure the access token is included in the Authorization header of your API request.

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.

SPT
  • 139
  • 1
  • 6