WebAPI2中的Azure AD图形请求

时间:2019-02-13 09:45:25

标签: azure asp.net-web-api2 azure-active-directory azure-ad-graph-api

最近创建的WebAPI2 Web服务,以获取所有活动目录应用程序和用户的列表。可以使用Azure AD Graph API提取本地IIS上的应用程序和用户列表上的内容。

在Azure上将webAPI2部署为资源时。将按预期获取用户列表,但使用以下代码获取的应用程序列表将引发错误。

致电获取应用程序列表:

IPagedCollection<IApplication> applications= await activeDirectoryClient.Applications.ExecuteAsync(); 

错误堆栈

  

System.ArgumentNullException:值不能为null。   参数名称:类型      在Microsoft.Data.Edm.EdmUtil.CheckArgumentNull [T](T值,字符串parameterName)      在Microsoft.Data.Edm.EdmTypeSemantics.AsComplex(IEdmTypeReference类型)      在Microsoft.Data.OData.JsonLight.ODataJsonLightPropertyAndValueDeserializer.ReadNonEntityValueImplementation(StringpayloadTypeName,IEdmTypeReference ExpectedTypeReference,DuplicatePropertyNamesCheckerplicatePropertyNamesChecker,CollectionWithoutExpectedTypeValvenator collectionValidator,Boolean validateNValueProperValueValueValueBoolean      在Microsoft.Data.OData.JsonLight.ODataJsonLightEntryAndFeedDeserializer.ReadOpenProperty(IODataJsonLightReaderEntryState entryState,字符串propertyName,布尔propertyWithValue)      在Microsoft.Data.OData.JsonLight.ODataJsonLightEntryAndFeedDeserializer.ReadUndeclaredProperty(IODataJsonLightReaderEntryState entryState,字符串propertyName,布尔propertyWithValue)      在Microsoft.Data.OData.JsonLight.ODataJsonLightEntryAndFeedDeserializer.ReadEntryPropertyWithValue(IODataJsonLightReaderEntryState entryState,String propertyName)

申请流程:

  

我的Web应用程序假设A调用WebAPI B以获取用户和应用程序列表。 webAPI的应用程序类型是本机的,我正在使用UserPasswordCredential和AcquireTokenAsync获取访问令牌。

0 个答案:

没有答案
相关问题