In this blog post I am going to show how to add server to the Deployment Group using Azure DevOps. Why do you need to do that? You have to do that if you want to use Azure DevOps to deploy your applications to the server on premise or Azure VM or any other VM's in your favorite cloud.
Login to your Azure DevOps and click on Organization settings.
Navigate to the Deployment pools
Click on + New
Provide meaningful name
Click on Create button.
Remember to choose Use a personal access token ... and click on Copy script to the clipboard
Now login to your server you want to add into deployment group and open PowerShell as administrator. Paste the PowerShell script and click on Enter.
You can just use default values by clicking on Enter. The output should be something like this.
The magic folder A1 is created under azagent
You get also Targets 1 online
WorkerServerDem is my server computer name. Kind of interesting it is suppose to be WorkerServerDemo but obviously there is a boundary on the pc name in the Azure VM's.
Now it is time to create a Deployment group we are going to use for deployment of our best applications :-)
Navigate to your Azure DevOps project
And click on Pipelines -> Deployment groups -> Available pools
Click on +
Provide meaningful name, description and click on Create.
To check that everything is working as expected, navigate to the Pipelines -> Releases in the Azure DevOps
Click on New pipeline and choose IIS website and SQL database deployment
Click on Apply.
Provide Stage name
And click on 2 jobs 3 tasks
Select and remove SQL Deployment
And remove IIS Web App Manage and IIS Web App Deploy steps
By right click on them and Remove selected task(s).
Now click on + sign on IIS Deployment and select PowerShell task
Click on Add.
Provide Display name, Type - Inline and Script
In this case just for test we are going to run PowerShell command on the server, displaying the computer name
Now navigate to the IIS Deployment and choose our deployment group server we just created, WorkerServerDemo.
Click on Save -> Create release.
Navigate to the Releases and check that Release goes green
Click on it then Logs
Click on Check Computer Name step
And here we can see our computer name
If you like my post image, you can free download it from here.