SOLVED

Azure Cost Management API

Copper Contributor
3 Replies

@jroberts1010 

 

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

}

 

$url = https://management.azure.com/providers/Microsoft.Billing/billingAccounts/>billingAccountName>/custom...

$response = Invoke-RestMethod -Uri $url -Method Get -Headers $authHeader

yes, i understand but, i need to call that endpoint on a controller from an application in c#....is that posible?

best response confirmed by jroberts1010 (Copper Contributor)
Solution

Yes it is possible, @jroberts1010. Azure SDK for .NET (Billing + Consumption)

1 best response

Accepted Solutions
best response confirmed by jroberts1010 (Copper Contributor)
Solution

Yes it is possible, @jroberts1010. Azure SDK for .NET (Billing + Consumption)

View solution in original post