Azure-AcquireTokenAsync [英] Azure - AcquireTokenAsync

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

问题描述

在尝试访问Azure Billing API之前,我无法获取授权令牌.我已经在Azure中创建了我的应用程序并授予了权限等,如果我下载了C#示例应用程序,它将运行良好.但是,当我尝试在VB.net中编写它时,我得到了 我可以理解.....但是运行AcquireTokenAsync时出现错误,将ClientID(String)投射到IClientAssertionCertificate"……但是我不明白如何在AcquireTokenAsync方法中使用Azure客户端ID?

I'm failing to acquire an authorisation token before I try and access the Azure Billing API. I have created my application in Azure and granted permissions etc, if I download the C# sample app it works fine. However, when I try and write it in VB.net I get an error when running AcquireTokenAsync, "cast of the ClientID (String) to IClientAssertionCertificate", for which I can understand.....but I dont understand how do I use my Azure Client ID in the AcquireTokenAsync method?

Dim rTask As Task(Of AuthenticationResult) = objAuthContext.AcquireTokenAsync(String.Format("{0}/", ARMBillingServiceURL), ConfigurationSettings.AppSettings("ClientId"))
            Dim rUsageData As AuthenticationResult = Await rTask

预先感谢

Phil

推荐答案

似乎第二个参数需要是IClientAssertionCertificate的实例,而不是字符串.可能有一个实现该接口的对象,可以使用您的客户端ID字符串实例化该对象.

It would appear that the second parameter needs to be an instance of IClientAssertionCertificate, not a string.  There is likely a object implementing that interface which can be instantiated with your client id string.

您可以共享指向您所引用的C#示例代码的链接吗?

Can you share the link to the C# sample code you refer to?


这篇关于Azure-AcquireTokenAsync的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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