Saturday 3 June 2017

Deployment Groups in VS Team Services

Deployment groups provide robust out-of-the-box multi-machine deployment with team services release management. It allows you to run deployments across multiple machines. You can install agent on each of your target servers directly and run rolling deployment to those servers, unlike agent based deployments where you install build/deployment agents on proxy servers in an agent pool. You can use all tasks in task catalog on your target machines.

Deployment group allows you to create target deployment machine groups, without requiring you to register machines in agent pools or queues. Machine in a deployment group will have an agent registered with the named deployment group, within the team project providing required isolation for target environment (such as DevInt, QA, UAT, Demo, Production etc.), for a given product or project.

Logical group of targets (machines) having an agent installed on each of them is a deployment group. It represents your physical environments. It can be single-box, multi-machine or a farm of machines. You can specify the security context for your physical environments by using the deployment groups.

Let’s look at how to create a Deployment Group in Team Services.

 

In a team services team project, click on Build & Release –> Deployment Groups. Then click New or Add deployment group button to create a new deployment group.image

Provide a name for the deployment group and click Create button.image

A new deployment group get created and you can register different machines to the deployment group. To do that for windows machine you can copy the PowerShell script available and execute in the required machine. image

If you select “Use a personal access token in the script for authentication” it will generate a personal access token for the current user, scoped to Deployment group.image

You can setup agents in Windows or Linux machines. By selecting relevant machine type you can copy the script for the given OS.image

Execute the copied PowerShell script in a windows machine to register it with the Deployment group.image

Agent.zip will be downloaded and extracted to a folder A1 in system drive by the script.image

You can provide machine tags to identify/differentiate machine role within a deployment group. For example WebServer, DBServer can be such tags.image

You can provide a local user in the machine or domain user if your machine is in a domain to execute the agent service or it will be executed with system user by default.image Agent will be successfully registered with the Deployment group. You can add additional tags or remove the tags specified in the machines tab of the deployment group. A machine can be removed from the group if it is no longer required to be in the group.image

Now in your release definition you can use this deployment group to do deployments. You have to add a deployment group phase to your release definition.image 

You can use tags to filter for machines in a deployment group. This allows you to use multiple Deployment group phases in a release environment to perform different set of actions in different machines selected depending on the tags. image

You can set parallel execution options within a Deployment group phase, when you have multiple machines in a deployment group.image

Deployment groups are only available for VS Team Services and not available in on-premises TFS as of now. It will be available for on-premises TFS in future.

1 comment:

Vaibhhav Dangar said...

Hi Chaminda, excellent article.
Is there a way we can retrieve via any release task what tags values are set in the deployment group?
I intend to use the tag variable for constructing the website URL.

Thanks

Popular Posts