Get Azure invoice with .NET Core

door John Lian
Laatst bijgewerkt: 25-4-2017
Bewerken op GitHub

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 https://github.com/Azure-Samples/billing-dotnet-core-invoice-download.git
    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": "yourtenant.onmicrosoft.com",
        "SubscriptionID": "your subscription ID",
        "ClientID": "your client ID",
        "ClientSecret": "your client secret"
    }
    
  6. Run the sample.

    dotnet run
    

Contributing

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