Created
January 19, 2018 21:50
-
-
Save esell/7b70adb96b10998cd0d2e7b268400ec3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########################################### | |
# Generate or retrieve the API key - Log in to the Enterprise portal and follow the tutorial | |
# under Help - Reporting APIs. The first section under this help article explains how to | |
# generate or retrieve the API key for the specified enrollment. | |
# Source: https://docs.microsoft.com/en-us/azure/billing/billing-enterprise-api | |
# | |
# Endpoints and sample responses are here: | |
# https://docs.microsoft.com/en-us/rest/api/billing/enterprise/billing-enterprise-api-usage-detail#json-format | |
# You can use that documentation to help understand the key/values returned. | |
########################################### | |
$resource = "https://consumption.azure.com/v2/enrollments/YOUR_ENROLLMENT_NUMBER_HERE/usagedetails" | |
$result = Invoke-RestMethod -Method Get -Uri $resource -Header @{ "Authorization" = "bearer YOUR_API_KEY_HERE" } | |
Write-Output ("REST Call Result: '$($result)'") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment