Azure DevOps API 添加公钥 [英] Azure DevOps API Add public key

查看:25
本文介绍了Azure DevOps API 添加公钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够通过 API 添加用于 SSH 访问 Azure DevOps 的公钥,但我似乎无法在 doco 中找到方法.通过 UI 手动执行此操作是不可行的,因为这适用于许多用户和许多项目.谢谢

解决方案

API 没有记录,但是我们可以使用工具对其进行跟踪...您可以通过调用以下 REST API 来添加 SSH 公钥:

编写脚本以使用 ssh-keygen 命令为用户创建 SSH 密钥,请参阅

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

解决方案

The API is not documented, however we can track it with tools... You can add SSH public keys by calling below REST API:

Write a script to create the SSH keys with the ssh-keygen command for users, please see Use SSH key authentication for details.

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屋!

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