Viewing and Modifying Hostnames
Updated: April 14, 2015
To allow your role instances to be referenced by host name, you must set the value for the host name in the service configuration file for each role. You do that by adding the desired host name to the vmName attribute of the Role element. The value of the vmName attribute is used as a base for the host name of each role instance. For example, if vmName is webrole and there are three instances of that role, the host names of the instances will be webrole0, webrole1, and webrole2.You do not need to specify a host name for virtual machines in the configuration file, because the host name for a virtual machine is populated based on the virtual machine name.For more information about configuring a Microsoft Azure service, see Azure Service Configuration Schema (.cscfg File)
You can view the host names of virtual machines and role instances in a cloud service by using various tools: Azure portal, service configuration file, Remote Desktop, and Azure Service Management REST API.
You can use the Azure portal to view the host names for virtual machines on the virtual machine dashboard page. Keep in mind that the dashboard shows a value for Name and Host Name. Although they are initially the same, changing the host name will not change the name of the virtual machine or role instance.
Role instances can also be located in the Azure portal, but when you list the instances in a cloud service, the host name is not displayed. You will see a name for each instance, but that name does not represent the host name.
You can download the service configuration file for a deployed service from the Configure page of the service in the Azure portal. You can then look for the vmName attribute for the Role name element to see the host name. Keep in mind that this host name is used as a base for the host name of each role instance. For example, if vmName is webrole and there are three instances of that role, the host names of the instances will be webrole0, webrole1, and webrole2.
After you enable Remote Desktop (Windows), Windows PowerShell remoting (Windows), or SSH (Linux and Windows) connections to your virtual machines or role instances, you can view the host name from an active Remote Desktop connection in various ways:
hostnameat the command prompt or SSH terminal.
ipconfig /allat the command prompt (Windows only).
View the computer name in the system settings (Windows only).
From a REST client, follow these instructions:
Ensure that you have a client certificate to connect to the Azure portal. To obtain a client certificate, follow the steps presented in How to: Download and Import Publish Settings and Subscription Information.
Set a header entry named
x-ms-versionwith a value of
Send a request in the following format:
Look for the HostName element for each RoleInstance element.
You can also view the internal domain suffix for your cloud service from the REST call response by checking the InternalDnsSuffix element, or by running
You can modify the host name for any virtual machine or role instance by uploading a modified service configuration file, or by renaming the computer from a Remote Desktop session.