Azure active directory 如何知道对我的应用程序的其他API的权限

Azure active directory 如何知道对我的应用程序的其他API的权限,azure-active-directory,Azure Active Directory,如何知道my azure ad app对其他API(如Microsoft Grahp API)的权限 在门户中,我可以在[API Access]-->[Required permissions]中检查,但如何使用powershell检查,我使用了 Get-AzureRmADApplication -ObjectId , Get-AzureRmADApplication -ObjectId xxxxx | fl * 但返回的属性很少,AppPermissions为null,但对于fiddl

如何知道my azure ad app对其他API(如Microsoft Grahp API)的权限

在门户中,我可以在[API Access]-->[Required permissions]中检查,但如何使用powershell检查,我使用了

Get-AzureRmADApplication -ObjectId , 
Get-AzureRmADApplication -ObjectId  xxxxx | fl * 
但返回的属性很少,AppPermissions为null,但对于fiddle,我注意到它使用了以下请求:

GET https://graph.windows.net/mytenant/applications/id?api-version=1.6 HTTP/1.1 
我可以找到该应用程序的许多属性,哪一个显示了该应用程序的权限,以及如何在powershell中获得该权限?

您可以尝试使用以下命令:

$app = Get-AzureADApplication -Filter "appId eq '$appId'" | fl *
要获取
RequiredResourceAccess
声明,即azure ad classic门户中“对其他应用程序的权限”和新门户中“所需权限”下显示的集合

此外,PowerShell本质上包装了API,并以简化的界面将其呈现给您。如果找不到执行所需操作的命令,则始终可以使用PowerShell直接调用Graph API。请参阅以下文章,了解如何从Powershell调用Azure Active Directory图形Api:

下面是一个测试代码示例:

PS C:\Users\v-nany> $header = @{
>>      'Content-Type'='application\json'
>>      'Authorization'=$token.CreateAuthorizationHeader()
>>  }
PS C:\Users\v-nany>  $uriSAs = "https://graph.windows.net/xxxxxxx/applications/xxxxxx?api-version=1.6 "
PS C:\Users\v-nany> $appInfo = (Invoke-RestMethod -Uri $uriSAs –Headers $header –Method Get –Verbose)
PS C:\Users\v-nany>  $appInfo.requiredResourceAccess

您将获得
resourceAppId
表示资源,以及相关的
resourceAppId
,这是一个范围列表。

可能重复的我不知道什么是主体,我知道我的应用程序对象Id我可以使用对象Id和v2.0模块来查找我的应用程序吗?@Phoenix,是的,尝试以下操作:get AzureADApplication-objectid xxxx,并检查此文档: