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 API (preview) provides programmatic access to your Azure billing information and invoices.
Install the NuGet package directly from the Visual Studio Package Manager console or with the .NET Core CLI.
Install-Package Microsoft.Azure.Management.Billing
dotnet add package Microsoft.Azure.Management.Billing
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