Azure Devops - Deployment Group
July 10, 2021 17:46I have been using Azure Devops default hosted agent - both cloud and self hosted agents for various personal and org application build and deployments. Recently was tasked migrating custom developed deployment script to Azure Devops. The custom deployment script had lot of intricate steps involving software / application installation and configuration. It was a challenge to accommodate all the steps in release pipelines Agent Job. The worst nightmare is to test if migrated script matches legacy deployment.
Azure Devops pipeline has deployment group - which is a logical set of deployment machines having agents installed in them. This seemed to suit my requirement of executing custom deployment script without much hassle. You could group multiple target machines for an group to deploy and further granular control can be achieved via tags associated with target machine.
You will need to create a deployment group
In the next page you will be provided with a registration script that needs to be executed in the target script. Enabled the "Use a personal access token in the script for authentication" checkbox and copy the script.
Now login to target machines that will be associated with deployment group. Open powershell (if target machine is windows) in administrator mode and execute the script copied in previous step. Agent will be installed in target machine with the selected option during installation.
Note: If you need to install any module / software make sure you provide local administrator account username and password during registration.
In release pipeline add deployment group job
If you are using same deployment group to deploy multiple application to various target machine, you could tag each target machine. Select the required tag in deployment group job and deployment will be targetted only to that specific machine.
I had all the infrastructure setup ready and coming to have the actual script i reused existing from repository. Created powershell task and executed function in script witih required parameters. Now that i am reusing tested script from Azure Devops release pipeline i did not worry about rewriting already available code.
Comments are closed.