Child pages
  • Microsoft Azure cloud
Skip to end of metadata
Go to start of metadata

Redirection Notice


General Info




Apache 2.0






TeamCity Azure cloud integrations allows TeamCity to use your Azure account to automatically manage virtual machines with TeamCity agents on-demand, based on the queued builds.

An Azure virtual machine/image with an installed TeamCity agent pre-configured to start the TeamCity agent on boot is required.


Currently two plugins are supported: Resource Manager and Classic. Select an appropriate plugin according to the Microsoft deployment guidelines.

You can download the last successful plugin build and install it as an additional TeamCity plugin.

Resource ManagerDownload9.1.2+blog post
ClassicDownload8.1.x+blog post

Resource Manager Plugin

The plugin supports generalized virtual machine images to start TeamCity build agents. You must use the Azure AD application and the authentication key to enable cloud integration and assign the Contributor role for it in your subscription on the new portal.

You need to prepare virtual machine with TeamCity build agent and capture it as VHD image to use it as a source for cloud build agents.

Classic Plugin

Depending on the type of the virtual machine, the plugin behavior is different:

Start/Stop behavior

If you use an existing virtual machine instance, TeamCity will start and stop it on demand. The instance is started before a build and  is stopped after the build is finished or an idle timeout elapses (depending on the profile settings). The instance state is saved. When the TeamCity server URL changes, you need to change the serverUrl parameter in to point to the new server.

Clone behavior

If you use a virtual machine image, TeamCity will create and start a new instance from the image and stop and delete it after it becomes unnecessary - the build is finished or an idle timeout elapses, depending on the profile settings. To use this behavior, you need to create an Azure virtual machine image from an existing instance. Refer to the Microsoft Azure web site for details on creating Windows and Linux virtual machine images.

Virtual Machine Preparation

  1. Create a new virtual machine in the Microsoft Azure.
  2. Install a TeamCity build agent on it and configure the agent to to be launched automatically on the virtual machine start.


    If you plan to start the TeamCity build agent as a Windows service running under the SYSTEM account, change the service startup type to the Automatic (Delayed Start).

    Gathering virtual machine configuration


    TeamCity Azure cloud plugins relies on the virtual machine configuration files provided by Azure OS provisioning services.

    Ensure that the OS user TeamCity agent is running under has access to C:\WindowsAzure\Config for Windows or /var/lib/waagent/ for Linux.

    • For Linux and FreeBSD machine, the plugin automatically tries to read information from /var/lib/waagent/ with sudo, if normal read fails.
    • If the plugin has no access to /var/lib without sudo, the integration will not occur. For instance, the following FreeBSD image has that problem.
  3. Perform virtual machine cleanup.

  4. Then execute VHD capturing process according to the Microsoft Azure documentation:

  • Resource Manager: Linux and Windows machines, supports only generalized images.
  • Classic: Linux and Windows machines, supports generalized and specialized images.

When creating an image, depending on whether you checked "I have run the Windows Azure Linux Agent on the virtual machine"/" I have run Sysprep on the virtual machine" checkbox, the image will be Generalized (checked) or Specialized (unchecked) and behavior will slightly differ:

  • Generalized image (Windows, Linux): TeamCity will pass the server URL directly into the created image, so you can use the same image with several TeamCityservers. You also need to provide a username/password to let Azure create a new user on a newly created VM. The credentials must match the Azure credentials requirements. See more details for passwords policy.
  • Specialized image (The user didn't prepare an image before the capturing) requires the serverUrl property in the file to point to the TeamCity server. If the server address changes, the image becomes invalid and you need to create a new one.

Cloud Profile

Configure and save the Azure cloud profile on the TeamCity server.

Note that if you make any changes to the image, you need to save the profile to pick up the changes.



Windows Azure uses the term 'virtual machine image' to refer to a master copy of a virtual machine and the term 'virtual machine instance' to refer to an individual virtual machine (VM), either cloned from an image or not. In the TeamCity Web UI the term 'image' is used to refer to an Azure source used by TeamCity to start a virtual machine: TeamCity either starts an Azure virtual machine instance or creates a virtual machine from an Azure image and starts it.

When the cloud profile is configured, the Images table in the TeamCity Web UI displays the sources configured, where a virtual machine instance is marked with the icon (M), and a virtual machine image is marked with the icon (I).


  • No labels