I am trying to develop an API for azure billing for CSP in azure functions using .net core 3 any guidance will be appreciated.
how do I call a billing API from the azure function?
I am trying to develop an API for azure billing for CSP in azure functions using .net core 3 any guidance will be appreciated.
how do I call a billing API from the azure function?
install with powershell:
Install-Package Microsoft.Azure.Management.Billing
code example:
/* 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();
Just follow below steps:
https://learn.microsoft.com/en-us/dotnet/api/overview/azure/billing
Above code is based on C#, you need to create a AAD app register first.