Skip to content

Latest commit

 

History

History
62 lines (46 loc) · 1.86 KB

File metadata and controls

62 lines (46 loc) · 1.86 KB
title description author ms.author ms.data ms.topic ms.devlang ms.service ms.date
Azure Billing SDK for .NET
Reference for Azure Billing SDK for .NET
pallavit
pallavit
01/17/2023
reference
dotnet
billing
10/19/2017

Azure Billing libraries for .NET

Overview

Azure Billing API (preview) provides programmatic access to your Azure billing information and invoices.

Management library

Install the NuGet package directly from the Visual Studio Package Manager console or with the .NET Core CLI.

Visual Studio Package Manager

Install-Package Microsoft.Azure.Management.Billing
dotnet add package Microsoft.Azure.Management.Billing

Code Example

Connect to Azure and get a list of invoices.

/* Include these directives
using Microsoft.Rest.Azure.Authentication;
using Microsoft.Azure.Management.Billing;
using Microsoft.Azure.Management.Billing.Models;
*/

// Log into Azure
var serviceCreds = ApplicationTokenProvider.LoginSilentAsync(tenantId, clientId, secret);
var billingClient = new BillingClient(serviceCreds);
billingClient.SubscriptionId = subscriptionId;

// Get list of invoices
billingClient.Invoices.List();

[!div class="nextstepaction"] Explore the management APIs

Samples