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 navigate to your Project. I am using my public Azure DevOps account and WorkerService public project here.
Go to Pipelines -> Deployment groups
Click on + New
Provide Name and Description
Click on Create.
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
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.