Forum Discussion
Azure Cost Management API
- Jan 14, 2020
Yes it is possible, jroberts1010. Azure SDK for .NET (Billing + Consumption)
Try 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
- jroberts1010Jan 14, 2020Copper Contributor
yes, i understand but, i need to call that endpoint on a controller from an application in c#....is that posible?
- hspintoJan 14, 2020
Microsoft
Yes it is possible, jroberts1010. Azure SDK for .NET (Billing + Consumption)