New to Azure custom VMs - a bit different than GCE

GCIT-Service 1 Reputation point
2020-02-25T23:03:41.757+00:00

Good afternoon.

I just successfully uploaded my first Linux custom image and, following the directions here:
https://learn.microsoft.com/en-us/azure/virtual-machines/linux/create-upload-centos?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#centos-70
Was able to prep the machine and have it boot on a VM.

However, I noticed when I used "waagent -force -deprovision", it returned the hostname to "localhost.localdomain". I had expected upon being provisioned as a new machine, that it would update that to the actual name of the VM being created. Any existing Linux image I've played with in Azure, derives it's host name from it's VM name. It's a variation of CentOS7.

In digging a bit more, it appears that it might be the function of WALinuxAgent to update the hostname, but it isn't. It says it's provisioned, so if that's responsible for hostname editing, it should be doing it (but isn't).

3602-waagent.txt
Here's the log file (converted to .txt for uploading). I don't see any parameters pulled from Azure MetaData that even tells it the host name, but it's possible it's not even trying because of an error further upstream.

How can I get my custom Linux image to do that as well?

Thanks.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,029 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Darren Lavery 1 Reputation point
    2020-03-12T09:32:06.007+00:00

    I know quite a while back there was an issue with the cloud-init version, it would remove the SharedConfig.xml which is essential for waagent.

    some official docs for Centos 7:

    Preparing a CentOS 7 virtual machine for Azure is very similar to CentOS 6, however there are several important differences worth noting:
    The NetworkManager package no longer conflicts with the Azure Linux agent. This package is installed by default and we recommend that it is not removed.

    So perhaps the cloud init must be removed and should solve this problem.

    Let us know! all the best!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.