I am developing a client-server application where I want the client (Azure VM) to send its instance ID to the server. The server will use this instance ID to link it with the corresponding VM from the list of imported Azure instances (using Azure cloud credentials).
I am facing some problems:
I am using the web endpoint which the client talks to , to get its instance ID. However, as mentioned in the article (https://azure.microsoft.com/en-us/blog/what-just-happened-to-my-vm-in-vm-metadata-service/), I get empty info returned. How do I get the instance ID?
From the imported VMs, I don't get any attribute which is the instance ID but rather just instance Name and Private ID along with a bunch of other information.
I didn't have this problem for AWS as I clearly get instance ID on both sides.
Maybe you could use something like:
curl -H Metadata:true "http://169.254.169.254/metadata/instance/compute/vmId?api-version=2017-08-01&format=text"
As described here: https://docs.microsoft.com/en-us/azure/virtual-machines/windows/instance-metadata-service