Use a Startup Script for Windows Azure Nodes

Applies To: Microsoft HPC Pack 2008 R2, Microsoft HPC Pack 2012, Microsoft HPC Pack 2012 R2

You can configure a startup script that runs automatically on a set of Windows Azure nodes when they are started (provisioned) in Windows Azure. Using a startup script, you can ensure that a group of nodes are configured properly to run specific jobs. Additionally, the nodes are restored to a known state if they become unavailable because of a service interruption and the role instances need to be provisioned in Windows Azure again. For example, using a startup script, you can install applications or drivers, configure a shared folder, or open firewall ports for specific applications. You can also use a startup script to configure subsets of nodes differently within the set of Windows Azure nodes that are deployed using a particular node template.

In this topic:

  • General steps to configure and use a startup script

  • Script names

  • Environment variables

  • Example

  • Log files


  • Windows Azure startup scripts are supported starting with HPC Pack 2008 R2 with Service Pack 2.

  • If a startup script takes longer than 15 minutes to complete, the Windows Azure Fabric Controller might cause the provisioning of a role instance to fail.

General steps to configure and use a startup script

The following are the general steps for configuring and using a startup script for your Windows Azure nodes:

  1. Create a configuration script (for example, startup.bat) that uses environment variables to differentiate nodes and to set different configurations. For more information, see the remaining sections in this topic.

  2. Use the hpcpack command to package the script and upload it to the Windows Azure storage account that is used for deploying the Windows Azure nodes.


    Do not specify the /relativePath parameter when packaging and uploading the startup script. The startup script should only run from the root directory of the Windows Azure nodes.

  3. Create or edit a Windows Azure node template to specify the startup script.

  4. Start (provision) the Windows Azure nodes.

    The startup script is automatically deployed to the Windows Azure nodes and runs on the nodes. If a problem occurs when the script runs, you can review the error logs. For more information, see Troubleshoot Deployments of Windows Azure Nodes with Microsoft HPC Pack.

Script names

You must ensure conformity between the name of the package that you upload to Windows Azure and the name of the script that runs (and that is specified in the node template). Only the naming conventions in the following table are allowed:

Script name Package name

file.extension (example: startup.bat) (example:

-OR- (example:

Environment variables

You can use the environment variables in the following table, which are set automatically on the Windows Azure nodes, to help configure your startup script:

Environment variable Description


The name of the Windows Azure node that is automatically configured by Microsoft® HPC Pack – for example, AZURECN-0014.


A comma-delimited list of node groups that the node belongs to. Allows the behavior of a script to be specialized for different subsets of the nodes.


HPC_NODE_GROUPS is set only when the Windows Azure node is first started. The variable is not dynamically updated if the variable is updated and the node is then provisioned again.


The following example is a batch file that configures a firewall rule on a subset of nodes that are identified by the node group Port31337 Server Group. You can adapt this pattern to create startup scripts that perform other tasks.

@echo off
echo %HPC_NODE_GROUPS% | findstr /C: "Port31337 Server Group"
if %errorlevel% == 0 (
echo Creating firewall exception
netsh advfirewall firewall add rule name="MyRule" dir=in protocol=tcp localport=31337 action=allow enable=yes

Log files

If a problem occurs when a startup script runs, review the log files for the script. The logs for the startup scripts are listed in the following table. The log files are in the %CCP_HOME% folder on each Windows Azure worker node.

Log file Description


Exit code and output stream


Error stream

See Also


Configuring a Windows Azure Node Template for Microsoft HPC Pack