Azure Instance Metadata Service – Windows is case-insensitive and Linux case-sensitive

Written by James McDonald

September 7, 2019

When calling to a Resource manager API from Windows and Linux there are some differences to the URL. Just got caught with this because of a copy and paste from one to another.

Windows with lower case “resourcegroups” works

(Invoke-WebRequest -Uri https://management.azure.com/subscriptions/<SUBSCRIPTION ID>/resourcegroups/Toggen-VM?api-version=2016-06-01 -Method GET -ContentType "application/json" -Headers @{ Authorization ="Bearer $ArmToken"}).content

Linux with camelcased “resourceGroups”

curl https://management.azure.com/subscriptions/<SUBSCRIPTION ID>/resourceGroups/Toggen-VM?api-version=2016-09-01 -H "Authorization: Bearer ${ACCESS_TOKEN}"

Incidentally to get a token

There doesn’t seem to be a simple power shell command to get a token… You can make a more complex rest call but the following is the easiest. IMHO

az account get-access-token

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…

Squarespace Image Export

To gain continued access to your Squarespace website images after cancelling your subscription you have several...

MySQL 8.x GRANT ALL STATEMENT

-- CREATE CREATE USER 'tgnrestoreuser'@'localhost' IDENTIFIED BY 'AppleSauceLoveBird2024'; GRANT ALL PRIVILEGES ON...

Exetel Opt-Out of CGNAT

If your port forwards and inbound and/or outbound site-to-site VPN's have failed when switching to Exetel due to their...