简体   繁体   中英

Hardcode arguments to the PowerShell Script in VSTS Release definition

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.

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM