Azure IMDS + Java SDK

156 Views Asked by At

Im pretty new to the Azure cloud world, so kinldy bare with my question. I have the following requirements,

  1. Fetch the azure vm name
  2. Start and Stop this application from another application in the same vm. For example: Lets say we project A and B A can start and stop B and both are inside the same Azure vm

I see that we can use Azure's IMDS to fetch the vm name and an whopping amount of metadata using the non-routable IP (169.254.169.254) but is there any equivalent Java SDK ?

1

There are 1 best solutions below

0
On

Microsoft does not currently publish any SDK for interacting with IMDS, although some SDKs do have helpers that wrap calls to IMDS as a part of their implementation details.

You need to construct the REST calls yourself, but fortunately it's a very simple API. You can find example code here: https://github.com/microsoft/azureimds/blob/master/imdssample.java

If an SDK something you'd like to see, consider making that feature request to Microsoft :)