Sometimes we have a scenario to update the devops pipeline variables dynamically during the task execution without having to update manually and create new release. you can use the below approach by adding Powershell task to the pipeline.
# Write your PowerShell commands here.
$cosmosconnstr = "$(cosmosconnstring)"
if("$(cosmosconnstring)".Chars("$(cosmosconnstring)".Length - 1) -eq ';')
{
$cosmosconnstr = "$(cosmosconnstring)".TrimEnd(';')
}
Write-Output("##vso[task.setvariable variable=ApplicationSettings.CacheConnection;]$cosmosconnstr")
#End
#Run the below script in another stage to make sure you get the updated value
Write-host "CacheConnection Variable in previous task is: $(ApplicationSettings.CacheConnection)"