Get Azure invoice with .NET Core

This is a simple .NET Core sample that uses the Azure .NET SDK to programmatically get your invoices.

Run this sample

  1. Get the .NET Core SDK.

  2. Get the Account Admin of the subscription to opt in and turn on API access to invoices.

  3. Create an Azure service principal either through Azure CLI, PowerShell or the portal.

  4. Clone the repository and install dependencies

    git clone
    cd billing-dotnet-core-invoice-download
    dotnet restore
  5. Edit appsettings.json using your subscription ID, tenant domain, client ID, and client secret from the service principle that you created. Example:

        "TenantDomain": "",
        "SubscriptionID": "your subscription ID",
        "ClientID": "your client ID",
        "ClientSecret": "your client secret"
  6. Run the sample.

    dotnet run


This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact with any additional questions or comments.