Azure API: List Invoices works, but downloading gives `AuthorizationFailed`.

Jürgen Drachta 25 Reputation points

I'm trying to download an invoice via


but it always results in a 403 "AuthorizationFailed" error.

The interesting thing is, listing all invoices via


work flawlessly, and this is also where I get the download URL from it's response.

Does it makes any sense, that I have access to the list of invoices, but not to the invoice download?

For accessing the API, I registered an app and use the secret to create an authentication token. The app is also enabled in the Billing Account as Billing Reader.

Azure Cost Management
Azure Cost Management
A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.
1,984 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Jürgen Drachta 25 Reputation points

    Indeed, there was an error in my code with the HTTP methods!

    The following now works


    Then I get a response 200, with the field value -> documents -> URL for a download link. Using this link in a POST yields


    results in a 202, with a header containing Location. A GET on this location, downloads the PDF


    Thanks for the quick help!

    1 person found this answer helpful.
    0 comments No comments

  2. AnuragSingh-MSFT 19,601 Reputation points

    Jürgen Drachta, thank you for posting this question on Microsoft Q&A.

    I understand that you are trying to download Invoice using the API mentioned here - Invoices - Download Invoice

    Note that this API uses HTTP POST method and not GET. Please try using the POST method with the URL and see if you are still this issue.

    In case you are still facing this issue, can you please share the following additional details:

    1. API Document which contains information about using these APIs.
    2. Sample request/response (after removing the sensitive information and Auth tokens)

    Hope this helps. Please let us know if you have any questions.