Setting a Web/Worker Role Name

I was recently reminded by my friend Nuno that you can actually set the name of the machine used in a Windows Azure Cloud Service (Web or Worker Role).  Normally I really don’t care about the name of the machine.  I’m fine with RD-whatever.


If I did care, there is a way to set that machine name.  There is a “vmName” attribute in the Role element of the role’s .cscfg file.

<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="CloudServiceName" xmlns="" osFamily="3" osVersion="*" schemaVersion="2013-10.2.2">
  <Role name="WebRole1" vmName="CollierWeb">
    <Instances count="1" />

Doing so will result in the machine name being set to whatever is in the “vmName” attribute, appended with the instance number (0, 1, 2, etc.)

Keep in mind that the “vmName” attribute value must be less than 10 characters.

Note that the role name will still be whatever is set in the .cscfg, appended with the instance number.


For more on the schema of the .cscfg file, please see MSDN.