使用 PowerShell 设置 TFS 审批人 [英] TFS set approver with PowerShell

查看:59
本文介绍了使用 PowerShell 设置 TFS 审批人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 TFS 2018 中有一个发布定义.对于每个环境,我都可以在 GUI 中设置预部署批准者(AD 组).我需要从代码(最好是 PowerShell)中做到这一点.

I have a release definition in TFS 2018. For every environment, I can set pre-deployment approver(s) (AD group) in the GUI. I need to do this from code (preferably PowerShell).

有没有办法做到这一点?我没有找到任何方法来通过 REST API 实现这一点.

Is there a way to do this? I did not find any way how to achieve this via REST API.

推荐答案

你只需要使用 创建发布定义 API,并在preDeployApprovals"参数中添加approver.检查下面的例子

You just need to use create a release definition API, and add approver in "preDeployApprovals" argument. Check the example below

"preDeployApprovals": {
  "approvals": [
    {
      "rank": 1,
      "isAutomated": true,
      "isNotificationOn": false,
      "approver": {
        "id": "4adb1680-0eac-6149-b5ee-fc8b4f6ca227",
        "displayName": "Chuck Reinhart",
        "uniqueName": "Domain\\username",
        "url": "http://TFS2018:8080/tfs/DefaultCollection/_apis/Identities/4adb1680-0eac-6149-b5ee-fc8b4f6ca227",
        "imageUrl": "http://TFS2018:8080/tfs/DefaultCollection/_api/_common/identityImage?id=4adb1680-0eac-6149-b5ee-fc8b4f6ca227"
      },
        "id": 0
      }
  ]
}, 

这篇关于使用 PowerShell 设置 TFS 审批人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆