TeamCity on Azure Marketplace

Some time ago we announced TeamCity Azure Resource Manager for TeamCity deployment in Azure cloud. Now we’re glad to provide the TeamCity offer in the Azure Marketplace for streamlined TeamCity setup.

It is also available as a TeamCity download option on the official JetBrains site:

teamcity-site-deploy-2-azure

The offer lets you run a JetBrains TeamCity server and a local agent on an Azure Linux VM in Azure.

Today we’ll go over a TeamCity instance setup on Azure, which will save you time and effort of configuration tasks.

Prerequisites

You’ll need an Azure subscription and about 10 minutes to set up TeamCity.
Note: Make sure you have a contributor and user access administrator roles on Azure.

Installation

Most of the TeamCity installation is automated, all you need to do is perform a few steps:

  1. Log in to the Azure portal.
  2. In your browser, open the TeamCity offer in the Azure Marketplace.
  3. Select GET IT NOW
  4. Review the pricing and terms information, select Continue.
  5. Select Create at the bottom of the page to configure a TeamCity installation.
  6. Configure settings:
    1. In the Basics tab, create a new resource group, in our case teamcity_demo:
    2. Configure Virtual machine settings: provide the username and authentication type. The recommended approach is to use SSH key for that. Password authentication is not recommended due to the known issue with CoreOS metadata service which breaks the startup of the default build agent. The Domain name label, DNS Prefix for the TeamCity server, will be auto-filled for you. If editing it, make sure it is globally unique.
      At this step, you also need to configure and save the subnet settings. Click OK to save the Virtual Machine settings.
    3. On the Additional Settings tab, select the TeamCity installation size and provide a password for the MySQL database of your TeamCity instance.
    4. Review the summary on the next screen. If required, download the template and parameters on your local machine for future use. Go on creating the TeamCity instance by clicking Ok.
  7. Review the privacy policy and if you agree, proceed by using Create. The deployment in progress message appears and you can click on it or the notification icon at the top to review the progress. The Operation Details link can be useful if an error occurs.
  8. Click Refresh. Upon a successful installation you’ll see the TeamCity URL name in the deployment Outputs tab:
    teamcity-outputs-DNS

That’s it! Now you can use the URL to access your TeamCity instance: you’ll need to accept the license agreement and set up the administrator account credentials.

You are ready to use your TeamCity installation, which includes the server and one local agent. See the TeamCity Quick start guide to configure and run your first build.

You might also want to expand your installation and make it more flexible by performing a couple of additional steps.

Adding Azure agents

Your TeamCity setup includes a TeamCity server and a local agent. You can add more agents to your installation using the cloud profile:

In the TeamCity Web UI, go to the Project Settings | Cloud Profiles and select Azure to create a cloud profile to start TeamCity agents:teamcity-profile

Configure a VM image:

Select teamcity-demo resource group, set container (preview) as the image type, and specify the jetbrains/teamcity-agent docker image. Configure the remaining settings and save them.

Note that specifying the storage account will persist container volumes in Azure, preventing the agent upgrade on each start.

teamcity-profile-image

After you finish the setup, it’ll take the agent about 10 min to connect to the TeamCity server: this time is required to start a VM from the created image, then the machine needs to download all the required plugins, etc.

The connected agent will be visible on the agent page:

teamcity_agents2

Configuring artifact storage

By default, TeamCity uses built-in storage for artifacts. To switch to Azure cloud storage, perform the following:

  1. In the TeamCity Web UI, go to the Project Settings | Artifacts Storage tab. The built-in TeamCity artifacts storage is displayed by default and marked as active.
  2. Click Add new storage. Select Azure as the storage type. Optionally, provide a name for your storage.
  3. Supply your storage credentials:
    1. in the Azure portal, go to Storage accounts -> Access keys and copy the storage account name
    2. paste it to the account name in the TeamCity.
    3. Perform the same for the key – any of the two keys available on the portal will work.
  4. Save your settings.
  5. The configured Azure storage will appear on the Artifacts storage page. Make it active using the corresponding link.
    teamcity-artifact-storage-active

Now TeamCity will store build artifacts externally.

Happy building!

This entry was posted in FYI, News & Events, Partner and tagged . Bookmark the permalink.

7 Responses to TeamCity on Azure Marketplace

  1. Thomas Due says:

    Great guide. However the local agent does not seem to install, how does one proceed here?

  2. John Gibbons says:

    2 questions:

    1. TeamCity webserver created by template is only accessible via HTTP. Isn’t that incredibly insecure? For example, when logging in via web UI, submitting username and password? Also when build agents communicate back to the build server?

    2. My TeamCity VM is based in UK South. When adding an agent using instructions above (using Container (preview), I get: ImageError
    >>Microsoft.ContainerInstance is not available in uksouth region
    Hide stacktrace
    jetbrains.buildServer.clouds.base.errors.CheckedCloudException: Microsoft.ContainerInstance is not available in uksouth regionjetbrains.buildServer.clouds.base.errors.CheckedCloudException: Microsoft.ContainerInstance is not available in uksouth region
    at jetbrains.buildServer.clouds.azure.arm.types.ValidationExtensionsKt.checkServiceExistence(ValidationExtensions.kt:52)
    at jetbrains.buildServer.clouds.azure.arm.types.AzureContainerHandler$checkImage$2.invokeSuspend(AzureContainerHandler.kt:20)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:32)
    at kotlinx.coroutines.ResumeModeKt.resumeUninterceptedMode(ResumeMode.kt:45)
    at kotlinx.coroutines.internal.ScopeCoroutine.onCompletionInternal$kotlinx_coroutines_core(Scopes.kt:25)
    at kotlinx.coroutines.JobSupport.completeStateFinalization(JobSupport.kt:299)
    at kotlinx.coroutines.JobSupport.tryFinalizeSimpleState(JobSupport.kt:258)
    at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:755)
    at kotlinx.coroutines.JobSupport.makeCompletingOnce$kotlinx_coroutines_core(JobSupport.kt:735)
    at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:117)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:45)
    at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:236)
    at kotlinx.coroutines.EventLoopBase.processNextEvent(EventLoop.kt:12

    I guess I could try creating TeamCity VMs in other regions by trial and error but why isnt’ this working in UK South?

  3. john says:

    Hmm I tried also East US and got same error: Microsoft.ContainerInstance is not available in eastus region. Note: I’m looking to create a Windows Agent, and I was using jetbrains/teamcity-agent as the docker image. Should I have appended some suffix or used a different docker image? I’d like to do VS 2017 builds or worst case MS Builds 15.0s

  4. john says:

    Registering Container Instances did the trick.

    I still can’t build on teh windows agent though because no .net framework 4.5.2. It would be really cool to have a container instance capable of building plain vanilla VS 2017 projects out of the box but in the absence of same, I guess that the managed image is the way forward in for me at this point.

    Thanks for your input!

Leave a Reply

Your email address will not be published. Required fields are marked *