1

我正在使用TFS 2015 Update2发布管理为我们的内部LOB应用程序开发发布管道。 “Windows计算机文件复制”和“在目标计算机上运行PowerShell”等各种任务需要将管理凭据作为输入参数传递。这些管理员凭据在目标节点上具有管理权限。我正在使用这些Windows服务帐户。我们有一个组织安全策略来每年轮换密码。维护TFS发布管理的密码

考虑到这一点,每年为新密码更新数百个TFS版本定义是很麻烦的。

你有更好的主意来处理这个问题吗?

感谢您的帮助和建议。

回答

1

您可以通过REST API以编程方式更新发行版定义,该文档已被充分记录并相当简单。

EX(注意,这是更新3及更高版本,每个文档,在TFS 2015.2的API可能略有不同):

PUT https://fabfiber.vsrm.visualstudio.com/DefaultCollection/ff213d65-d61d-447c-b39d-d16f21b18364/_apis/release/definitions/28?api-version=3.0-preview.1 

Content-Type: application/json

{ "id": 28, "name": "Fabrikam.CD", "createdOn": "2016-04-11T11:04:05.197Z", "createdBy": { "id": "52a5bc8d-4730-400a-95c7-7276d4ae5953", "displayName": "Chuck Reinhart", "uniqueName": "[email protected]", "url": "https://fabfiber.vssps.visualstudio.com/_apis/Identities/52a5bc8d-4730-400a-95c7-7276d4ae5953", "imageUrl": "https://fabfiber.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=52a5bc8d-4730-400a-95c7-7276d4ae5953" }, "environments": [ { "name": "Dev", "rank": 1, "deployStep": { "tasks": [] }, "owner": { "id": "52a5bc8d-4730-400a-95c7-7276d4ae5953", "displayName": "Chuck Reinhart", "uniqueName": "[email protected]", "url": "https://fabfiber.vssps.visualstudio.com/_apis/Identities/52a5bc8d-4730-400a-95c7-7276d4ae5953", "imageUrl": "https://fabfiber.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=52a5bc8d-4730-400a-95c7-7276d4ae5953" }, "queueId": 2, "demands": [], "conditions": [], "variables": {}, "runOptions": {}, "environmentOptions": { "emailNotificationType": "Always", "skipArtifactsDownload": false, "timeoutInMinutes": 0 }, "executionPolicy": { "concurrencyCount": 0, "queueDepthCount": 0 }, "preDeployApprovals": { "approvals": [ { "rank": 1, "isAutomated": true, "isNotificationOn": false } ], "approvalOptions": null }, "postDeployApprovals": { "approvals": [ { "rank": 1, "isAutomated": true, "isNotificationOn": false } ], "approvalOptions": null } } ], "artifacts": [ { "alias": "FabrikamCI", "type": "Build", "definitionReference": { "project": { "name": "Fabrikam", "id": "ff213d65-d61d-447c-b39d-d16f21b18364" }, "definition": { "name": "Fabrikam.CI", "id": "1" } }, "isPrimary": false } ], "variables": {}, "triggers": [], "revision": 1, "releaseNameFormat": "", "retentionPolicy": { "daysToKeep": 60 } }

+0

对不起被拖入其他的东西。变量保持PWD被返回作为 – Sam

+0

变量保持PWD返回为 “变量”:{ “AppPoolIdentityName”:{ “值”: “SVC-帐户” }, “AppPoolIdentityPassword”:{ “值” :null, “isSecret”:true } 现在图片我有2个秘密变量。但是,通过我的REST Api Update调用,我需要更新其中的一个。这看起来如何?我是否需要将所有内容都包含在我的更新调用中,或者只是将我的更改包含在修补程序中。 – Sam