维护TFS版本管理的密码

时间:2016-08-25 14:41:58

标签: powershell tfs tfs2015 release-management ms-release-management

我正在使用TFS 2015 Update2版本管理为我们的内部LOB应用程序开发Release管道。有各种各样的任务,如" Windows机器文件复制"和#34;在目标计算机上运行PowerShell"需要管理员凭据作为输入参数传递。这些管理员凭据在目标节点上具有管理访问权我正在使用Windows服务帐户。我们有一个组织安全策略来每年轮换密码。

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

你有更好的想法来处理这个问题吗?

感谢您的帮助和建议。

1 个答案:

答案 0 :(得分:2)

您可以通过REST API以编程方式更新版本定义,该文档记录完备且非常简单。

Ex(请注意,这适用于Update 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": "chuckreinhart@outlook.com", "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": "chuckreinhart@outlook.com", "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 } }