Forum Discussion
Azure Cost Management API
Does anyone know how to get an access token to access that endpoint and those who are also on the page?
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers?api-version=2019-10-01-preview
https://docs.microsoft.com/en-us/azure/cost-management/get-started-partners
- Yes it is possible, jroberts1010. Azure SDK for .NET (Billing + Consumption) 
3 Replies
- drmiruCopper ContributorTry this: $azContext = Get-AzContext $azProfile = [Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureRmProfileProvider]::Instance.Profile $profileClient = New-Object -TypeName Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient -ArgumentList ($azProfile) $token = $profileClient.AcquireAccessToken($azContext.Subscription.TenantId) $authHeader = @{ 'Content-Type'='application/json' 'Authorization'='Bearer ' + $token.AccessToken } $response = Invoke-RestMethod -Uri $url -Method Get -Headers $authHeader - jroberts1010Copper Contributoryes, i understand but, i need to call that endpoint on a controller from an application in c#....is that posible? - hspintoMicrosoft Yes it is possible, jroberts1010. Azure SDK for .NET (Billing + Consumption)