如何安装 AzureAD PowerShell 模块

kum*_*mar 4 powershell azure-active-directory

当我尝试安装 AzureAD 模块时,出现以下错误:

Import-Module -Name AzureAD
Run Code Online (Sandbox Code Playgroud)

导入模块:未加载指定的模块“AzureAD”,因为在任何模块目录中都找不到有效的模块文件。

Phi*_*ret 6

Import-Module加载您已安装在系统上的 PowerShell 模块。在您的情况下,该模块尚未安装。

要安装 Azure AD PowerShell,您需要使用Install-Module

Install-Module -Name "AzureAD"
Run Code Online (Sandbox Code Playgroud)

如果您想将模块安装到当前用户(即没有管理员权限),您可以这样做:

Install-Module -Name "AzureAD" -Scope CurrentUser
Run Code Online (Sandbox Code Playgroud)

Azure AD PowerShell 模块(以及如何安装它)的文档位于:https : //docs.microsoft.com/powershell/azure/active-directory/install-adv2?view=azureadps-2.0#installing-the-天蓝色广告模块