You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

通过VSTS Rest API创建发布:如何设置变量值及命名规范?

Setting Release Variables via VSTS/Azure DevOps REST API's ReleaseStartMetadata

Great question! Let's break this down clearly for you:

Core Answer

Yes, you can set release-level variable values using the properties collection in the ReleaseStartMetadata object when creating a release via the REST API. But you do need to follow a specific naming convention for the property keys to make it work.

Required Naming Format & Examples

  • Each variable entry in properties must use the key pattern: releaseVariables.{YourVariableName}
  • The value for each key needs to be an object containing a value field (this is the actual value you want to assign to the variable). Here's a practical JSON example:
    "properties": {
      "releaseVariables.DeployTargetEnv": {
        "value": "Production"
      },
      "releaseVariables.BuildVersionTag": {
        "value": "v2.4.1"
      }
    }
    
  • For secret variables (values that require encrypted storage), add an isSecret: true property to the object:
    "properties": {
      "releaseVariables.DBAdminPassword": {
        "value": "SecurePass_123!",
        "isSecret": true
      }
    }
    

Key Notes

  • These values will override the default variable settings in your release definition, but only for the specific release instance you're creating.
  • Ensure the variable name (the part after releaseVariables.) matches exactly with the variable name in your release definition—this is case-sensitive, so double-check spelling and capitalization to avoid issues!

内容的提问来源于stack exchange,提问作者cdarrigo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 10:05:43