Hardcode arguments to the PowerShell Script in VSTS Release definition

梦想与她 提交于 2019-12-08 12:00:37

问题


I have PowerShell scripts to deploy csv files into Azure tables storage.Now,I want to configure these scripts in VSTS at the release definition after the WebApp deployment is done.So once the web app deploy is done,I will execute these scripts using VSTS PowerShell task.So I have 6 environments ,My PowerShell script will have to be deployed into different azure storage accounts(Environments).So I need to pass the storage account name,storage account key,resource group separately for different environments but my PowerShell script will be the same.So I can pass these arguments using argument field of PowerShell task in VSTS.But I don't want to pass using that field option.So,Is there any best way to pass those arguments at the release definition of VSTS. Please help me on this.


回答1:


The simple way is using environment variable:

  1. Add variables with the same name (different value) for each environment, such as storageAccountName

  1. Using environment variables in PowerShell task, Arguments - storageAccountName $(storageAccountName)


来源:https://stackoverflow.com/questions/47669594/hardcode-arguments-to-the-powershell-script-in-vsts-release-definition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!