Share via


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.

  1. 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;
            return updatedDefinition;
        }