Automatic download of Azure invoices from multiple subscriptions

Are you chased by your finance department to give them the invoices of all of your Azure subscriptions? The answer “You can download them from the portal…” is not enough for them? Here is a tool that can help both you and them.

Use PowerShell to download all your invoices! Microsoft.Azure.Commands.Billing namespace is your friend. The  Get-AzureRmBillingInvoice has a parameter  -GenerateDownloadUrl that does what it’s name suggests. What else you need? The   System.Net.WebClient  has a DownloadFile  method, so all we need is to create the overhead code around these.

If you receive  WARNING: You are not allowed to download invoices. Please contact your account administrator ( to turn on access in the management portal for allowing to download invoices through the API.  error message, please ask the owner of the Subscription to enable “Access to invoice”.