Showing posts with label agent. Show all posts
Showing posts with label agent. Show all posts

Wednesday, 12 September 2018

Using Unified Agent for Executing Automated Tests Without Installing Visual Studio in Test Client–Azure DevOps/VSTS

As described in the post “Running UI Tests with Unified Agent” you can setup unified agent (same agent used for build/deployment in Azure DevOps/VSTS), in an application pool or in a deployment group to execute functional UI tests. The unified agent is really useful as it does not require to setup separate test agent using winRM based Deploy Test Agent task which is required if Run Functional Tests task is used for automated test execution.With unified agent you can use Visual Studio Test task, which is capable of running Selenium based UI tests as well, in addition to Coded UI tests. There was a dependency that you needed to have Visual Studio installed in the test client machine to get the Visual Studio Test task as it is packaged with Visual Studio. However, thanks to the NuGet package “Microsoft Test Platform”  you no longer need to install full Visual Studio in your test client machine to execute automated tests, with unified agent using Visual Studio Test task. Let’s look at how to use “Microsoft Test Platform”  and Visual Studio Test task in a test client using Azure DevOps Release Management.

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.

Tuesday, 28 June 2016

Make Agent Queues - Usable to Team Project Users–TFS 2015 Build/Release Agent Pool Usage Access in Build/Release Definitions

Agent queue in a TFS 2015 build definition will not be listed for team project administrator, even though he can save a build definition.image

To make agent pool available for the user creating a release or build definition in TFS 2015, you have to add to Agent queue users in the team project collection agent queues, “Agent Queue Users” role.image

This will make the queue available to the build/release definitions. But this will enable access to all agent queues.image

This happens because when you add to, it gets added to All queues level when you add as shown above. image

To restrict to a given agent remove from “Agent Queue Users” role, of the collection and add only to the relevant agent queue.image

image

This will make the user added only to the relevant queue, Agent Queue Users. Not to the collection role. image

Only the permission granted agent queue is available for the user.image

Wednesday, 8 June 2016

Deploying to an Untrusted Domain–TFS 2015 Release Management Service

To setup an Agent (build/release agent), in an untrusted domain, follow the below steps.

1. Create local user in TFS App Tier machine say rmshadowagent

image

2. Navigate to TFS control panel using http://yourtfs:8080/tfs/_admin/_AgentPool and create a new agent pool. Then download the agent.zip file and keep it, to copy over to the target agent machine.image

3. Select the agent pool and click on Roles. Add the local user (rmshadowagent)created in TFS App Tier to the “Agent Pool Administrators” role, by clicking Add and then “Add Windows user or group”.image

image

4. Add the same user to “Agent Pool Services Accounts” role for the selected pool.image

5. Copy over the agent.zip downloaded to the untrusted domain machine (agent machine). This machine should have access to you tfs url. This can be achieved via exposing your TFS via www. Then a machine with internet connection having access to TFS url can be an agent. Create folder for your agent. Example – C:\DeployAgent\Web, and extract agent.zip to it.image

image

image

6. Create a working folder in agent machine for the agent.image

7. In agent machine, if there is any credential remembered in the control panel for the TFS url, remove them. This is to make sure that you can provide credentials when configuring the agent.image

image

image

8. In the agent machine create a user with the same user name say “rmshadowagent” and with the same password, you created in the TFS App Tier. (Add this user to Administrators group in agent machine to allow to perform any activity in the machine as a deployment agent).image

image

9. Run a command prompt as administrator in the agent machine and change the directory to extracted agent folder. Then execute ConfigureAgent.cmd and provide the parameters to configure.

  • Name for the agent
  • TFS url – https://yourtfs/tfs
  • Agent pool name
  • Agent working directory path
  • Install agent as service – y
  • Instead of Network Service for the service user – provide .\rmshadowagent
  • Provide the password for the rmshadowagent

image

10. Once click ok it gives below error. But the agent is configured and available to use in pool.

TF14045: The identity with type 'System.Security.Principal.WindowsIdentity' and
identifier 'S-1-5-21-1292816864-2021176197-253083057-1013' could not be found.

image

image

With this agent in untrusted domain build output gets downloaded, successfully confirming agent is running fine.image

image

Tuesday, 5 August 2014

Custom Action to Run SQL Script With Parameters in VS 2013 Release Management Deployment Agent

How to pass parameters to SQL script running from VS 2013 Release Management? Let me show you step by step.

First we need a SQL Script to Run as a test. Here is a very simple SQL Script written in SQLCMD mode.
INSERT INTO [dbo].[Customer]
           ([Id]
           ,[Name])
     VALUES
           ($(Id)
           ,'$(Name)')
GO
This script is inserting a record to a table with two columns. The script cannot be directly executed in SQL Management Studio since the $(Id) and $(Name) variables are not set. If tried will get below error.
a2 
To test the script run the below command in command prompt.
sqlcmd -S "POC-DOLPHINQA" -d "TestDB" -i "C:\Temp\TestSQL.sql" -v Id=3 Name="Chandrasekara" –b
a3
This adds a row to the table successfully.
a4
To create a new Action in the VS 2013 Release Management –> Log on to Client and go to Inventory tab and select Actions –> Click New
Create an action as shown below.
 a1
Arguments should be
-S "__ServerName__" -d "__DatabaseName__" -i "__ScriptName__" -v __Params__ -b

This will add below parameters to the action

ServerName – SQL Server Instance Name
DatabaseName – Database Name the script should run
ScriptName – Script to execute with full path (In deployment machine. Copying script to deployment machine can be done using XCOPY Deployer)
Params – Parameters for the SQL Script

Now this action can be used in Release template.
a2
Let’s try a release.
a3
The new action execution succeeded.
a2
Table is added with new record.
a4
This custom action can be used even to execute script while dynamically changing target DB, tables, columns etc. using SQLCMD syntax.
For example
Use $(MyDatabaseName)
SELECT x.$(ColumnName)
FROM Person.Person x

Monday, 4 August 2014

Setup Deployment Agent

Deployment Agent is responsible for downloading the payload for deployment form the Release Management Server and perform release steps in the deployment machine. Release Management Agent (Deployment Agent) is licensed separately for each target server and for details refer here.
Let’s have look at how to setup a deployment agent for VS 2013 Release Management. I have explained in earlier posts on setting up a Release Management Server and a Release Management Client.
Launch Deployment Agent setup.
001

Installer will be very quick.
002
 
003

Launch to configure.
004
005
We need an account to set up agent. Let’s add a domain account.
006
 007

Make sure to add the rmagent account created above to the deployment machine local administrators group.
012
013 
It is really easy when configuring a Deployment Agent in the same domain as Release Management Server. Use the created domain account as the account for Deployment Agent and provide Release Management Server url to configure. The user running the configuration should have Release Manger role in the server.
008
Configuration succeeds.
009

Successful configuration can be verified in services.
010
rmagent account is added as a service account to Release Management Server
011
Now the Deployment Agent machine can be registered in the Release Management Server.
Adding a deployment agent is easy in the same domain. To add a machine outside of domain follow below steps.
1. Create account rmshadowagent as window user in Release Management Server.
2. Create same account with same password in deployment agent machine, and add the rmshadowagent account to local admin group the deployment agent machine.
3. Add rmshadowagentwith only user name to RM server and make him ReleaseManager and a service user
014
4. Log on to deployment agent machine with rmshadowagent user or in deployment agent run the deployment agent configuration as rmshadowagent user (run as different user).
015
016
5. In configuration screen provide shadow agent user name (only rmshadowagent ) and password, and Release Management Server url. Release Management Server url can be exposed as https, so that this can be used to configure agent (example – Production machine in client’s environment) fully outside of the Release Management Server network.
Note use of .\rmshadowagent or machine\rmshadowagent will give error "user is not a release manager and service"
017
6. After “Apply Settings” and configured successfully, removal of shadow user (rmshadowagent ) release manger role is possible. (if adding new agent with this user again, temporary make him release manager)
Successfully configured agent machine can now be registered in the Release Management Server.

Popular Posts