Configure VSTS local build agent for deploys - azure-devops

I have a local VM that has successfully been running builds from VSTS.
After the builds are completed I have a deployment job that pushes my artifacts to a number of servers. This has been working fine for the past few months.
This morning, I received a message that I was out of "deployment minutes" and my deployments failed, however my builds completed.
Obviously it was building locally, but deploying in the cloud.
Is there a way I can configure my agent or my deployment job within VSTS to use my local agent?

You should just be able to switch your release definition to use the same agent queue as your builds. In each environment, click on each phase and change the agent queue it uses from "Hosted" to whatever you named your local agent queue.
You may need to install additional software (Azure PowerShell, if you're deploying to Azure, for example), but it will work the same -- the build and release agents are exactly the same software and use exactly the same tasks.

You should be able to add your agent to the pool (it requires some software installed there of course) and then select it instead of a hosted environment in the deployment step configuration:
Agent pools
At the bottom you can find:
The hosted pool provides all VSTS accounts with a single hosted build agent and a limited number of free build minutes each month. If you need more hosted build resources, or need to run more than one build concurrently, then you can either:
- Deploy your own on-premises build agents
- Buy additional hosted pipelines

Here is where I finally found the option to specify which agent the release should run on:

Related

Agent Pool & Deployment Pool

I have to configure the CI/CD pipelines for 2 web applications hosted in On-Premise environments & those web applications have multiple platforms (i.e. Dev, Test, QA & Prod). Both are .net applications. On-premise application source code was located on TFVC & recently have been migrated to Azure DevOps (Git).
Now, next step is to build the CI/CD pipelines for these applications. Also, other projects which are already on Azure DevOps, as per customer security standards, Agent pools are being used for build pipelines & Deployment pools/Deployment groups are used for release pipelines & hence we would need to go by the similar approach to build the CI/CD pipeline for 2 applications. Customer would like to use existing deployment pool to be used for rest 2 applications as well. Hence no need to build deployment pools so existing deployment pool could cater to multiple projects. How to achieve it?
Now, looking at the existing configuration of Agent Pools in Azure DevOps, we see that they are using Build Agent hosted in On-premise (TFS server itself) & is being used for building code for few projects.
Can same TFS server i.e. Build Agent could be used for other projects as well? Do we need to install Build agent again onto that server & run commands?
How about release pipeline? I assume, we need to build multiple stages for the release to happen.
Can someone explain step by step process please? I am not from development background & hence struggling a little bit.
You donot need to create new build agents or deployment pools for another projects in the same organization.
You can using the existing build agent pools and deployment pools in multiple projects by following below steps.
Go to project settings of the other project-->Agent pools under Pipelines-->Add Pool-->Existing-->Select an existing pool
Then the two projects can share the same build agents in the same agent pool.
Adding deployment pools to other project is simple too. See below:
In the portal of the other project-->Go the Deployment groups in Pipelines section-->go to Available pools tab-->Click the plus "+" to add the existing deployment pool to this project.
Then the release pipelines of both projects can target the same deployment pool.
Update:
If you cannot adding the existiong agent pool. You probably donot have the permission. You need to ask the administrator to add you as the reader. See below steps:
Go to the Organization Setting-->Agent pools under Pipelines-->Select the agent pool you want add to another project-->Go to Security Tab-->Add your account as Reader.

Azure Release pipelines. Deploy artifact to all instances of the scaled-out web application

We have Azure Build and Releases pipelines for our App Service. Everything is pretty straight-forward.
We initially configured single instance for the App Service and Release pipeline worked great.
But after scaling it out to 3 instances what we learned was that release pipeline delivers artifact only to one of 3 instances
So, the question is, how we can configure it in a way so artifact is deployed to all instances of the App Service regardless how many of them there are
Additional details:
this ASP.Net Core 3.1 project
we use "Azure App Service deploy" task
You will probably want to use deployment groups by changing your agent to a deployment group agent phase.
The deployment group allows you define multiple target environments, add tags, and target those tags on specific phases. I'm suspecting that you have installed the agent on all the target machines, but it will only run once and will pick from any agent registered in the pool. Instead, I believe you want it to run on every target.
You can even configure the release pipeline to automatically deploy the last deployment release as new targets are added.
You might reference this answer about the difference between an agent pool and deployment pool: Azure Devops (VSTS) Different between Agent Pool and Deployment pool

deploy app to on-prem environments with azure dev ops

I'm building an Azure DevOps pipeline to deploy a custom-build powershell application to several on-prem environments that we support. I configured the required agent pools and installed them as a service on the on-prem environment.
Next, I have set up my pipeline in Azure DevOps, selecting a GitRepo:
Build (with the steps: Use Nuget, Nuget Restore, Build solution, Update version, Copy Files, and Publish build Artifact)
Release (with step: Publish Build Artifact)
Some things are unclear for me:
Do I need the Publish Build Artifacts twice? Can the Build pipeline
end with Copy Files step, and that the Release pipeline picks up this
artifact?
It is my understanding that the release publishes the app to the
on-prem environment (in my case). Where can I set a custom path (ie:
C:\deployed_apps) where the app needs to be deployed? When I tested
this pipeline, I got errors that the path I created using an variable
was not found.
What am I missing in my setup to get this pipeline working?
As #Shayki Abramczyk
pointed out this task is not for deployment, it just upload your Build Artifacts to azure devops server where your release pipeline can download directly.
In your case, if you want deploy your application to several on-prem environments, You need to create a deployment group first, A deployment group is a logical set of deployment target machines that have agents installed on each one. You application will be deployed to those machines in a deployment group in release pipeline. Check here for more details about deployment group.
After the deployment group is created, you can add a deployment group job by click the 3 dots, and then specify your deployment group as below pic shows, You can then simply add a copy file task or other deployment tasks to deploy your application to your on-prem machine.
In the release pipeline you shouldn't use the Publish Build Artifact. in the end of the build you put this step, what this step does? upload your artifacts to the Azure DevOps or to a file share. now in the release pipeline you choose the build artifact (in the left pane). the first thing that the agent does when the release pipeline started is to download the build artifacts to the agent. now you need to take them and deploy it to your environments. how? it depends which kind of application is (it can be just copy files, it can be deploy to IIS, etc.).
You can put the path in the variables tab and use this variable when you deploy the app (with copy files task, for example).

how to deploy an application to a particular ubuntu server using azure-devops?

I have my code in the azure repos.I have created the release pipeline which runs the task "npm install" and "npm run start".This will deploy my application.But I want to deploy this application to my ubuntu server 206.189.22.155 from the azure release pipeline.Is there any way I can configure the release pipeline to use my ubuntu server?
The only agent pool available for me is "Azure Pipelines" and for agent specification I used "ubuntu-16.04".Iam totally confused about how this works.
I just want my application to run on http://206.189.22.155:5000. I can run the application directly in the server, but the whole point is to run it from the release pipeline.So how do I connect the pipeline to my ubuntu server?I think my default azure uses some kind of virtual machine for deployment.
You can create a deployment group in Azure DevOps. Deployment groups in Azure pipelines make it easier to organize the servers you want to use to host your app. In Azure pipelines -> Devployment group, select “+New” button and type of target to register. Copy and run the Registration script in your Ubuntu server.
You can refer to https://learn.microsoft.com/en-us/azure/devops/pipelines/apps/cd/deploy-linuxvm-deploygroups?view=azure-devops&tabs=java-script#define-your-ci-build-pipeline and https://learn.microsoft.com/en-us/azure/devops/pipelines/release/deployment-groups/index?view=azure-devops for more detailed information
After you create the deployment group, you can choose it in your release pipeline
And after you configure you deployment group, you can deploy your app to the specific server.

Are there seperate VSTS agents for build vs release?

I am getting my first VSTS build and release definitions setup.
Test server destination, on prem
project is using VS 2017 professional
Earlier I setup a private agent for doing the build, following this.
https://learn.microsoft.com/en-us/vsts/build-release/actions/agents/v2-windows?view=vsts
The agent installed fine and I can see it from build & release / agent pools
However, have now switched to using a hosted agent for that so I can remove the need to install visual studio on a test server.
Now I want to deploy the build to my test server, which is on premises. Do I need yet another agent or can I use the one I setup already. In other words are build agents separate from release agents? The agent I setup earlier is running as a service.
The build agent can be used in VSTS build and release, also the deployment group agent is configuring with build agent too.
You don’t need to setup another build/release agent, there are many tasks to deploy app to another server, such as IIS Web App Deployment Using WinRM, PowerShell on Target machine, Windows Machine File Copy.
The build and release agents are the same, but you have to install an on-premise agent to deploy your projects in your network. Is not that you can not use the hosted agent, but you would have to use WinRM and open you network, which may not be a good idea.
After you installed your on-premise agent, you don't have to install VS on the machine to run tests. You can add the following task to your release.