Skip to content

Instantly share code, notes, and snippets.

@srpomeroy
Created October 3, 2020 00:12
Show Gist options
  • Save srpomeroy/c5c0e61900c6e6824b9143839a366a83 to your computer and use it in GitHub Desktop.
Save srpomeroy/c5c0e61900c6e6824b9143839a366a83 to your computer and use it in GitHub Desktop.
Microsoft Azure EA Legacy API - Reserved Instance Utilization Example
# Source: https://docs.microsoft.com/en-us/rest/api/billing/enterprise/billing-enterprise-api-reserved-instance-usage
$enrollmentId = ""
$apiToken = ""
$startDate = "" ## yyyy-mm-dd | Example: 2020-10-01
$endDate = "" ## yyyy-mm-dd | Example: 2020-10-01
$uri = "https://consumption.azure.com/v2/enrollments/${enrollmentId}/reservationdetails?startDate=${startDate}&endDate=${endDate}"
Invoke-RestMethod -Method Get -UseBasicParsing -Uri $uri -Headers @{"Authorization"="bearer ${apiToken}"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment