本文介绍了使用当前的Active Directory凭据对Azure DevOps进行身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在尝试构建一些需要访问Azure DevOps的内部开发人员工具。我们在Azure DevOps中的组织以及我们的计算机都链接到同一个Azure Active Directory,因此我认为应该可以通过以下方式传递该身份验证
;如果我输入了用户名和密码以登录到Windows,然后我就可以通过Windows身份验证访问网络资源,那么Azure DevOps也应该这样,因为它是相同的Active Directory。但是,没有我尝试过b $ b的方法似乎生成了有效的凭据,而且我找不到任何涵盖这种情况的文档。我试过了:


new VssCredentials()


new VssCredentials(true)


new VssCredentials(新的WindowsCredential())


新的VssCredentials(新的WindowsCredential(true))


新的VssCredentials(新的WindowsCredential(System.Net.CredentialCache.DefaultCredentials) )


新的VssCredentials(新的WindowsCredential(System.Net.CredentialCache.DefaultNetworkCredentials))


我也尝试将VssCredentials.PromptType设置为PromptIfNeeded ,但它没有效果。我总是得到同样的错误:Microsoft.VisualStudio.Services.Common.VssUnauthorizedException:VS30063:您无权访问https://< organization> .visualstudio.com。
有没有办法进行身份验证,不需要使用oAuth或强制每个用户手动创建访问令牌只是为了登录他们已登录的帐户?

解决方案

We're trying to build some internal developer tools that need to access Azure DevOps. Our organization in Azure DevOps, as well as our computers, are all linked to the same Azure Active Directory, so I assume it should be possible to flow that authentication through; if I've entered my user name and password in order to log on to Windows, and I'm then able to access network resources via Windows authentication, the same should work for Azure DevOps because it's the same Active Directory. However, no approach I've tried seems to generate credentials that work, and I can't find any documentation covering this scenario. I've tried:

new VssCredentials()

new VssCredentials(true)

new VssCredentials(new WindowsCredential())

new VssCredentials(new WindowsCredential(true))

new VssCredentials(new WindowsCredential(System.Net.CredentialCache.DefaultCredentials))

new VssCredentials(new WindowsCredential(System.Net.CredentialCache.DefaultNetworkCredentials))

I've also tried setting the VssCredentials.PromptType to PromptIfNeeded, but it has no effect. I always get the same error: Microsoft.VisualStudio.Services.Common.VssUnauthorizedException : VS30063: You are not authorized to access https://<organization>.visualstudio.com. Is there any way to authenticate that doesn't require using oAuth or forcing every user to manually create an access token just to log into the account they're already logged in to?

解决方案


这篇关于使用当前的Active Directory凭据对Azure DevOps进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 11:52