Saturday 26 July 2014

Tool & Action to Run Custom PowerShell Scripts in Deployment Agent – VS 2013 Release Management

Can we run a custom PowerShell script in Release Management Deployment Agent?  One way is to create a PowerShell script and add it as a resource and create a tool and an action in Release Management Inventory. This is more suitable for adding a generic tool. But if we want to run a custom PowerShell script specific to a given release template, copied to deployment machine from the build drop, can we do that? Out of the box set of tools and actions in Release Management Server do not support this. We can do this by creating a generic tool and an action.
Let me show you how to do this step by step.
In Release Management Client go to Inventory tab Tools, click on New.
001

For the execution command type “powershell” and for the arguments type
-command __ScriptToExecute__  __Arguments__
This will add two parameters in the tool “ScriptToExecute” and “Arguments”. Provide a suitable Name and a Description as well.
002

Click on Save & Close to add the new tool.
003

Go to Actions and click on New to add new action.
004

Select the tool we have created and add a new Category for Custom Actions. Fill the Name and Description.
005

Save to create the new Action.
006
 007

Let’s test our Tool and Action in action. First we need a very simple PowerShell script like below.
008

In a test release template now we can see our custom action available.
009

Fill the script name with the path and arguments(for testing purpose script copied manually to deployment machine, this can be a script downloaded to deployment machine from the build drop using an XCOPY action in the release template).
010

Save the release template and click New Release to test. This example does not use a build out put, but the action can be used with a template bound to a build drop as well, as a matter of fact it can be used with any release template.
011 

Start the release by clicking on Start.
012

Script execution succeeded.
013

Click on View Log to see the output from script.
014

To fail a script based on a condition throw an exception like below and release action will fail.



Sunday 20 July 2014

Setup Release Management Client

This is the second step of setting up VS 2013 Release Management environment. Prerequisite for this step is Release Management Server which is described here.
Trial version of VS 2013 Release Management with update 2 can be downloaded from http://go.microsoft.com/?linkid=9843020.
Note: You cannot apply a license key for the trial to make it licensed version. Instead you have to uninstall trial and install licensed copy downloaded with MSDN or Volume License to apply license.

In the downloaded ISO run rm_Client.exe to install Release Management Client. This is a very quick install.
001

Installation is quick and smooth.

002
 003

Once lunched provide the url of the release management server. example – http://ReleaseManagmentServer:1000
Below picture shows TFS since this installation of the Release Management Client is done on tfs box.

004

This url is correct but cannot be connected by the client.

005

Check if Release Management Server app pool is running and if not start it.

 006

Try browsing to http://releasemanagemntserver:1000/ReleaseManagement

008

This could happen, if the Release Management Server is installed in TFS box with Sharepoint Foundation. To resolve this issue refer Release Management Server in TFS box with Sharepoint Foundation, the fix specified in there is below.


  • On the machine where the Release Management Server was installed with TFS and Sharepoint, start a Command Prompt. Run as Administrator but not sure this was required.
  • Navigate to C:\Windows\System32\Inetsrv
  • Enter the following command
    appcmd.exe set config -section:system.webServer/globalModules /[name='SPNativeRequestModule'].preCondition:integratedMode,bitness64

  • 009

    Browsing to http://releasemanagemntserver:1000/ReleaseManagement succeeds.

    012

    Below error occur if the user running Release Management Client is not added as a user in Release Management Server.

    013

    To resolve this issue add the user to Release Management Server, users, by clicking new on Administration tab Manage Users. (To do this log on to the Release Management Client with a user already available in release management server – example - run client as installation user of release management server).

    020

    Add the required user.

    021
     022

    Release manager is the super user role in Release Management Server.

    023

    The user should be able to connect to the Release Management Server from a remote machine using the Release Management Client.

    025
     026
     027

    We have setup a Release Management Server, and Release Management Client accessing the server from a remote machine successfully. Next step is to set up Deployment Agent(s).

    Tuesday 8 July 2014

    Setup VS 2013 Release Management Server

    Let’s look at step by step “How to setup a VS 2013 Release Management Server”, which is the heart of VS Release Management. To understand more, the best and the official resource you must go through is VS 2013 Release Management Installation Guide.  Trial version of VS 2013 Release Management with update 2 can be downloaded from http://go.microsoft.com/?linkid=9843020.
    Note: You cannot apply a license key for the trial to make it licensed version. Instead you have to uninstall trial and install licensed copy downloaded with MSDN or Volume License to apply license.
    Prerequisites for VS 2013 RM (Release Management) Server is below as per VS 2013 Release Management Installation Guide.

    Processor: 1 GHz Pentium processor or equivalent (Minimum); 2GHz Pentium processor or equivalent (Recommended). 
    RAM: 1024 MB (Minimum); 2048 MB (Recommended). 
    Hard Disk: On a clean machine, up to 2.2 GB of available space may be required. This is due to the dependency on .NET. Database can grow up to 1 GB per year (could be as low as 10 MB - depending on usage) 
    Display: 1024 x 768 high color, 16-bit colors (Minimum); 1280 x 1024 high color, 32-bit (Recommended). 
    Supported platform:  • Windows Server 2008 R2 SP1 • Windows Server 2012 • Windows Server 2012 R2 
    Database requirements: Microsoft SQL Server 2008 or 2008 R2 or 2012

    The installing user (user who is setting up the Release Management Server) requires local administrator rights and sysadmin rights on the SQL Server (SQL Server that is going to have Release Management Server database). I will be using TFS Admin as the installation user of the RM Server since I am setting up the RM Server  in the same box  where the TFS is installed. Ideally the RM Server should be set up in a different clean computer and TFS is not mandatory to do release panning and execution with VS 2013 Release Management. (TFS is optional, but can be integrated really well with VS 2013 RM to automate from builds to release).

    As the first step we need to setup an account, to be used as the service account for the Release Management Server.

    001

    002

    Run the downloaded rm_server.exe to launch the setup.

    003
    004

    Accept license agreement and click “Install”.

    005

    Once install launch to configure.

    006
     007
     008

    In the configuration window specify the release management service account and SQL Server to create the RM database.

    009 

    Apply settings, you will encounter the first error in RM Server configuration, and fortunately it is a descriptive error “The account specified is not a member of the local administrators group”.

    010

    Add the RM Service account to local administrators group to resolve this issue.

    011

    Now the configuration proceeds.

    012


    The next error which might occur if the server resources are limited (This demo environment has only one cpu core and 4GB RAM while running SQL, SharePoint Foundation2013, TFS in same box). The error message is not very helpful.

    013

    Log file shows failing when getting RM site state, looks like some time out.

    014

    Increase resources in the machine and retry the configuration, now fails with application pool already exists (I believe MSFT will make this experience of retry configuration, better in a future release).

    016

    Manually deleting app pool and any web sites created for Release Management will resolve the issue.

    015

    Retry configuration succeeds.

    017

    To confirm the success state of configuration verify below check list.
    1. Release Management database is created  in SQL Server.
    018

    2. RM Service account mapped to RM database dbo schema.
    019
    3. Release Management app pool is created with identity RM Service account, and RM web site is created as below.

    020 
    4. Release Management Monitor windows service is running with RM Service account.

    021

    Now we have a VS 2013 Release Management Server up and running. Next post of series VS Release Management, I will explain “How to setup and configure Release Management Client”.

    Popular Posts