首页 > 解决方案 > 使用 Get-AzureADApplication 获取 AAD 应用信息时出错

问题描述

我正在尝试使用“Get-AzureADApplication”命令获取 AAD 应用程序信息。但得到以下错误 -

Get-AzureADApplication : You must call the Connect-AzureAD cmdlet before calling 
any other cmdlets.
At C:\Users\v-pasahu\Desktop\Sample.ps1:18 char:11
+ if($app = Get-AzureADApplication -Filter "DisplayName eq '$($AppName) ...
+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-AzureADApplication], AadNee 
   dAuthenticationException
    + FullyQualifiedErrorId : Microsoft.Open.Azure.AD.CommonLibrary.AadNeedAuthe 
   nticationException,Microsoft.Open.AzureAD16.PowerShell.GetApplication

标签: azurepowershellazure-active-directory

解决方案


根据报错信息,需要先运行命令Connect-AzureAD

此外,如果您没有安装 azure powershell 模块,则应在使用 azure ad powershell 之前安装它。


推荐阅读