Utilities methods to use ReleaseManagement REST API’s

Refer post https://blogs.msdn.microsoft.com/chandananjani/2016/04/27/using-releasehttpclient-for-interacting-with-releasemanagement-service/ to know as which nuget package is required to be installed. How to add secret variable in release definition? public static ReleaseDefinition AddSecretVariableInReleaseDefinition(ReleaseHttpClient rmClient, string projectName, ReleaseDefinition definition) { var secretVariableKey = “secretVariableKey”; var secretVariableValue = new ConfigurationVariableValue { Value = “secretVariableValue”, IsSecret = true }; definition.Variables.Add(secretVariableKey, secretVariableValue); var updatedDefinition = rmClient.UpdateReleaseDefinitionAsync(definition, projectName).Result;…


Release is failing with ‘Object reference not set to an instance of an object’

In case your release is failing with ‘Object reference not set to an instance of an object’ post upgrade of your TFS with below snapshot just after creating the release In case you have moved your TFS server from one machine to other and ran PrepareClone, ChangeServerID, RemapDb following command https://www.visualstudio.com/en-us/docs/setup-admin/command-line/tfsconfig-cmd Workaround: – Create a…


CryptographicException while adding TFS connection to ReleaseManagement Update-4 client

One of our customer reported below error :- Issue:- While adding a TFS connection, user were getting CryptographicException Message: Bad Data.: \r\n\r\n   at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr)   at System.Security.Cryptography.RSACryptoServiceProvider.DecryptKey(SafeKeyHandle pKeyContext, Byte[] pbEncryptedKey, Int32 cbEncryptedKey, Boolean fOAEP, ObjectHandleOnStack ohRetDecryptedKey)   at System.Security.Cryptography.RSACryptoServiceProvider.Decrypt(Byte[] rgb, Boolean fOAEP)   at Microsoft.TeamFoundation.Release.Data.Helpers.CryptoHelper.GetDecryptedValue(String str, String containerName)   at Microsoft.TeamFoundation.Release.Data.Helpers.CryptoHelper.DecryptString(String str, String cryptoContainerName, String key, Encryption encryption)  …


Writing a ReleaseManagement extension for cloning an existing release definition

Code shared :- https://github.com/openalm/vsts-rm-extensions/tree/master/rd-export-import-clone-TFS2015U2 How to make Changes:- Step1: Clone the repository using the link https://github.com/openalm/vsts-rm-extensions.git Step2: Open a command prompt and go till folder ‘rd-export-import-clone-TFS2015U2’ Step3: Run ‘bower install’ [ pre-requsite for running ‘bower’ can be referred https://github.com/Microsoft/vsts-extension-samples] which will download 1.95.2 version of VSS.SDK.js Step4: Make your changes Step5:  Run ‘tfx extension create‘…


Using Clone, Export and Import an existing release definition for TFS2015 Update2

Summary:- A ReleaseManagement extension for Cloning, Importing and Exporting an existing release definition is released in the VisualStudio marketplace at https://marketplace.visualstudio.com/items?itemName=ms-devlabs.rm-clone-rd . But as it uses some improvement done post release of TFS2015U2 hence it doesn’t allow to be installed for TFS2015U2. I have tried to write another extension with slight variation of experience (explained below)….


Using ReleaseHttpClient for interacting with ReleaseManagement service

ReleaseHttpClient is public as nuget package : https://www.nuget.org/packages/Microsoft.VisualStudio.Services.Release.Client Fetching release definitions using given credential :- Step1: Create one ‘Windows Console Application’ using Visual studio 2015 Step2: Goto Tools –>NuGet Package Manager –> Manage NuGet Packages for Solutions –> Browse (make sure Package source: nuget.org) Step3: Search and Install following package to your solution  Microsoft.VisualStudio.Services.Release.Client Microsoft.VisualStudio.Services.InteractiveClient Step4:…


Using PAT token in ReleaseManagement REST API’s

Generating PAT Token:- Step1: Generate PAT token by visiting your profile and selecting the right ReleaseManagement scope as per API need ( see ‘Available scopes’ section https://www.visualstudio.com/en-us/integrate/extensions/develop/manifest ) Step2: Copy the token generated after clicking ‘Create Token’ as shown in image above   Code which uses the generated PAT token above :- public static async…


Using ReleaseManagement REST API’s

 Refer the documentation https://www.visualstudio.com/integrate/api/rm/overview (below samples uses alternate credential for authentication [https://www.visualstudio.com/en-us/integrate/get-started/auth/overview]) 1. How to get ReleaseDefinition using ReleaseManagement REST API’s public static async void GetReleaseDefinitions() { try { var username = “<alternate credential username>”; var password = “<password>”; using (HttpClient client = new HttpClient()) { client.DefaultRequestHeaders.Accept.Add( new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue(“application/json”)); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(“Basic”, Convert.ToBase64String( System.Text.ASCIIEncoding.ASCII.GetBytes( string.Format(“{0}:{1}”, username, password)))); using…


Release Management Server for Team Foundation Server 2013 installation failed

  One of our customer reported as “Release Management Server for Team Foundation Server 2013” installation fails with below error :- As per him “This server did have an older version of Release Management installed and we believe we have fully uninstalled it including removing the Release Management service and associated SQL DB. “ Solution…