Assigning a custom name to Cloud Services instances

The default instance name

Those of you who look at SQL database connection logs, or at tools like New Relic to monitor your Cloud Service applications, may have noticed that the list of servers running the application have names like “RD000D3A107CFC” (this is the host name in the network).

This name isn’t very useful when trying to identify which of the instances we see in the Azure Management Portal is the one that corresponds to that name. All instances in the portal are named as the role name followed by a number (e.g.: CloudService.Web_IN_1).

How can we check that name?

There are two options:

  • Access the instance with Remote Desktop and take a look at the system properties.
  • By code, calling Dns.GetHostName().

Setting a more descriptive name

Fortunately, we have an alternative, the only thing we need to do is set a vmName for our Role in the Service configuration file:


<ServiceConfiguration name="CloudService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration&quot; osFamily="4" osVersion="*" schemaVersion="2014-06.2.4">
<Role name="CloudService.Web" vmName="WebInst">
<Instances count="2"/>
<ConfigurationSettings>
</ConfigurationSettings>
<Certificates>
</Certificates>
</Role>
</ServiceConfiguration>

After this, our instances will be WebInst0, WebInst1, and so on.

To know all the options available for the configuration of the Role, you can visit: https://msdn.microsoft.com/en-us/library/azure/jj156212.aspx

Hope it helps!

@gjbellmann

1 thought on “Assigning a custom name to Cloud Services instances

  1. tbsbet

    This name isn’t very useful when trying to identify which of the instances we see in the Azure Management Portal is the one that corresponds to that name. All instances in the portal are named as the role name followed by a number.

    Like

    Reply

Leave a comment