简体   繁体   English

通过AD Oauth的Azure Service Management API访问失败

[英]Azure Service Management API access via AD Oauth fails

II'm having same issue as this - Azure Service Management API authentication using Azure Active Directory Oauth with slightly different scenario. II具有与此相同的问题- 使用Azure Active Directory Oauth在稍微不同的情况下进行Azure服务管理API身份验证

I'm running a headless app (with nunit to run integration tests) setup just as in http://msdn.microsoft.com/en-us/library/ee460782.aspx to get stage deployment url which is dynamic in all it's glory. 我正在运行一个无头的应用程序(使用nunit来运行集成测试),就像在http://msdn.microsoft.com/zh-cn/library/ee460782.aspx中一样,以获取阶段部署URL,该URL在所有情况下都是动态的。

I can call production url and run tests while authenticating requests with AD in a headless fashion but not service management api. 我可以调用生产url并运行测试,同时以无头方式验证与AD的请求,但不能验证服务管理api。 I've given permission to service management api for the service as in the walk-through. 我已按照演练的方式授予了该服务的服务管理API的权限。

Also, I get token via client credential calling : 另外,我通过客户端凭证调用获得令牌:

result = context.AcquireToken(
  "https://management.core.windows.net/",
  "{clientId}",
  clientCredential,   // had client id and key
  new Uri("{redirectUri}"));

A get Unauthorized: A Security token exception occurred for the received JWT token. 获取未经授权:收到的JWT令牌发生安全令牌异常。

The Get deployment url used is here - http://msdn.microsoft.com/en-us/library/ee460804.aspx I double-ched subscrption id, sevice names etc. 获取使用的部署URL在这里-http: //msdn.microsoft.com/zh-cn/library/ee460804.aspx我双预订了ID,服务名称等。

Anybody have insights on what's failing in spite of a seemingly valid token? 即使看似有效的令牌,有人对失败的原因有见解吗?

Is this ever known to be working with app key? 这是否曾经与应用程序密钥一起使用? I can't find a single example yet. 我找不到一个示例。

Use the AcquireToken(string resource, string clientId, UserCredential userCrential) overload instead. 请改用AcquireToken(字符串资源,字符串clientId,UserCredential userCrential)重载。 This is the function designed for headless apps. 这是为无头应用设计的功能。

Since the Service Management API only allows Delegated Permissions you need to supply credentials for a user (username and password) instead of an application (client id and key). 由于服务管理API仅允许委派权限,因此您需要提供用户(用户名和密码)的凭据,而不是应用程序(客户端ID和密钥)的凭据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM