python - 如何使用它的 python 客户端 API 对 Azure DevOps 进行身份验证?
问题描述
我正在尝试通过为此编写 python 脚本来自动在 azure devops 中创建用户。为此,我使用了 azure-devops 的 python 客户端 API。
截至目前,身份验证是使用个人访问令牌(PAT)完成的:
from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication
personal_access_token = <myPAT>
organization_url = 'https://dev.azure.com/<myOrganization>'
# Create a connection to the org
credentials = BasicAuthentication('', personal_access_token)
connection = Connection(base_url=organization_url, creds=credentials)
实际上,我有一个使用 Graph API 的脚本,它通过 ADAL 向 Azure AD 进行身份验证。这意味着我已经在我们的 Azure AD 中注册了一个应用程序,该应用程序是为使用 Graph API 而创建的。
我可以使用此应用程序及其客户端 ID 对 Azure DevOps 服务进行身份验证吗?如何将此身份验证方法与 Python 客户端 API 一起使用?
这篇关于 OAuth 2.0 身份验证方法的文章是否指向相同?: https ://docs.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/oauth?toc=%2Fazure%2Fdevops%2Forganizations%2Ftoc.json&bc=%2Fazure%2Fdevops%2Forganizations%2Fbreadcrumb %2Ftoc.json&view=azure-devops#register-your-app
我很困惑,因为它说要在 azure devops 中创建应用程序,而不是在 azure AD 中。
如果可能的话,任何人都可以通过澄清这一点并解释进行此身份验证的步骤来帮助我吗?
解决方案
推荐阅读
- javascript - 通过将鼠标悬停附加到圆圈,鼠标悬停在 d3.js 中不起作用
- angular - 我想从数组中获取对象的值
- google-chrome-os - Crostini 在另一台计算机上查看本地主机
- mysql - 事情在本地主机上工作,但没有服务器端出现错误:PHP 和 MySQL 的内部错误 500
- arduino - Arduino Galileo 英特尔:“DDRB”未在此范围内声明
- java - 如何使用 jaxb 将包含相同元素的不同类型的元素映射到单个 java 类 objetc
- java - ... 中的构造函数的参数 0 需要一个找不到的“org.springframework.web.client.RestTemplate”类型的 bean
- databricks - Databricks 作业查询
- spring-security - 将“nonce”值添加到 Spring 授权服务器的令牌响应中
- json - Python 2.7,Pycryptodome:由于编码问题,无法在服务器端验证私钥签名