Search code examples
azurebilling

Why the request of Invoices - List By Billing Subscription in Azure through the "try it" gives a 404?


Thanks in advance :) I performed a request of this (https://learn.microsoft.com/en-us/rest/api/billing/2019-10-01-preview/invoices/list-by-billing-subscription#code-try-0) with these parameters and it is answered 404. Can anyone give me a clue about what I am doing wrong? I am performing it with my user who is the owner of this personal account. Also, we performed this in a business account because we know this info is not available to every subscription. We performed this with an user who has billing reader permissions but it also gives 404.

  • billingAccountName: find in Cost Management + Billing > Properties
  • billingSubscriptionName: the id of the subscription name
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}/invoices?api-version=2019-10-01-preview&periodEndDate=2022-06-01&periodStartDate=2022-06-30
cache-control: no-cache
content-length: 0
date: Fri, 24 Jun 2022 09:31:35 GMT
expires: -1
mise-correlation-id: de3c5cae-0644-43c1-9941-dd675e595f2a
pragma: no-cache
x-frame-options: DENY
x-ms-correlation-request-id: b4d8cb29-13e9-4795-b17b-8d0eafea4d3e
x-ms-ratelimit-remaining-tenant-reads: 11994
x-ms-request-id: b4d8cb29-13e9-4795-b17b-8d0eafea4d3e
x-ms-routing-request-id: FRANCECENTRAL:20220624T093135Z:b4d8cb29-13e9-4795-b17b-8d0eafea4d3e
x-ms-service-version: 10.6.1992.510

Solution

  • Why the request of Invoices - List By Billing Subscription in Azure through the "try it" gives a 404?

    • If you are using a free Azure membership, you cannot view the invoice details.
    • Invoices are available only for billing accounts, billing profiles, and pay-as-you-go subscriptions.
    • In Azure Active Directory, check your role

    Navigate to Azure Portal => Azure Active Directory => Roles and administrators

    enter image description here

    • To know the role

    Navigate to the Azure portal => Your Resource Group => Access Control (IAM)

    enter image description here

    • Check whether you can give access to the Invoice

    • For the APIs to have access to the invoice data, we must grant them permissions via the Azure portal. Navigate to Azure Portal => Cost Management + Billing=> Your Subscription => Invoices =>Access to invoice => Select On => Save

    enter image description here

    enter image description here

    enter image description here

    • I am having the Contributor Role, when I try to access the Invoice got the below Message

    enter image description here