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 Manager||Download||9.1.2+||blog post|
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.
Depending on the type of the virtual machine, the plugin behavior is different:
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 buildAgent.properties to point to the new server.
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.
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).
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
Perform virtual machine cleanup.
Then execute VHD capturing process according to the Microsoft Azure documentation:
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:
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).