Azure DevOps API添加公钥 [英] Azure DevOps API Add public key
问题描述
我希望能够通过API添加用于通过SSH访问Azure DevOps的公共密钥,但是我似乎找不到在doco中实现此目标的方法.通过UI手动进行操作是不可行的,因为这对于许多用户和许多项目来说都是如此.谢谢
I would like to be able to add a public key for SSH access to Azure DevOps via the API but I can't seem to find a way to do it in the doco. Doing it manually via the UI is not feasible since this is for many users and many projects. Thanks
推荐答案
该API未记录,但是我们可以使用工具对其进行跟踪... 您可以通过调用以下REST API来添加SSH公钥:
The API is not documented, however we can track it with tools... You can add SSH public keys by calling below REST API:
编写脚本以使用ssh-keygen
命令为用户创建SSH密钥,请参阅
Write a script to create the SSH keys with the ssh-keygen
command for users, please see Use SSH key authentication for details.
然后调用REST API以添加公钥:
Then call the REST API to add the public keys:
POST https://{Account}.visualstudio.com/_details/security/keys/Edit
Content-Type: application/json
Request body:
{"Description":"Test1001","__RequestVerificationToken":"","AuthorizationId":"","Data":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGZyIoG6eH9nTm/Cu2nVDa7hTNfaMWkwayghFmYTvqCkOwao2YJesGVih1fA3oR4tPsVv4+Vr8wxPCfJCboUrL9NDoH1tAMsIlkQZHqgaJwnGNWnPrnp0r2+wjLQJFPq/pPd8xKwr6QU0BxzZ4RuLDfMFz/MR1cQ2iWWKJuO/TXYrSPtY9XqsmMC8Zo4zJln40PGZt+ecOyQCNHCXsEJ3C+QIUXSqAkb8yknZ4apLf1oqfFRngtV4w84Ua/ZLpNduPZrBcm/mCU5Jq6H37jxhx4kluheJrfpAXbvbQlPTKa2zaOHp7wb3B2E2HvESJmx5ExNuAHoygcq/QGjsRsiUR andy@xxx@ws0068"}
这篇关于Azure DevOps API添加公钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!