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.
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.
Click on Save & Close to add the new tool.
Go to Actions and click on New to add new action.
Select the tool we have created and add a new Category for Custom Actions. Fill the Name and Description.
Save to create the new Action.
Let’s test our Tool and Action in action. First we need a very simple PowerShell script like below.
In a test release template now we can see our custom action available.
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).
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.
Start the release by clicking on Start.
Script execution succeeded.
Click on View Log to see the output from script.
To fail a script based on a condition throw an exception like below and release action will fail.
It is great if the latest updates to TFS can be applied as and when they are released. But for a large organization it might not be sometime...
Generally windows services are deployed by creating an msi installer. It is possible to deploy msi via VSTS/TFS release management using the...
SQL Server Integration Services (SSIS) projects can be created to perform ETL (Extract Transform and Load) operations. As Implementing of Co...
If you have upgraded the TFS from TFS 2015 to TFS 2018 you will encounter a situation where your vNext build agents 1.xx are no longer valid...
TFS 2018 RC1 is now available and you can download it from https://www.visualstudio.com/downloads/ . Release note here explains the new fea...