当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 如何使用 PowerShell 连接到 Microsoft Entra

作者:精品下载站 日期:2024-12-14 03:23:51 浏览:13 分类:玩电脑

如何使用 PowerShell 连接到 Microsoft Entra


我们喜欢使用 PowerShell 连接到 Microsoft Entra,因为我们想要检索 Microsoft Entra ID 用户及其详细信息。在此之前,我们必须安装 PowerShell 模块。但我们需要哪个特定的 PowerShell 模块?在本文中,您将了解如何使用 PowerShell 连接到 Microsoft Entra。

使用 PowerShell 连接到 Microsoft Entra

Microsoft 发布的所有可让您连接到 Microsoft Entra 的 PowerShell 模块可能会让您不知所措。因此,为了使其更容易,您只需要 Microsoft Graph PowerShell 模块。

注意:您必须使用 Microsoft Graph PowerShell 与 Microsoft Entra 交互。此外,Microsoft Graph PowerShell 允许您访问所有 Microsoft Graph API,并且可在 PowerShell 7 上使用。

PowerShell 模块先决条件

在开始安装 Microsoft Graph PowerShell 模块之前,您需要满足以下先决条件。

1.以管理员身份启动以下应用程序之一(高权限):

  • Windows PowerShell
  • Windows PowerShell ISE
  • 视觉工作室代码

2.设置 Windows PowerShell 执行策略

默认情况下,我们无法安装脚本。要要求从 Internet 下载的所有 PowerShell 脚本均由受信任的发布者签名,请以管理员身份运行 PowerShell,然后运行 cmdlet。

Set-ExecutionPolicy RemoteSigned -Force

重要提示:关闭并重新打开提升的 Windows PowerShell 窗口以使更改生效。

3.安装PowerShellGet模块

以管理员身份运行 PowerShell。运行命令Install-Module PowershellGet -Force。当要求安装 NuGet 提供程序时,按 Y 并按 Enter 键。

Install-Module PowershellGet -Force

如果您收到无法安装的错误,请阅读文章无法安装 PowerShell 的 NuGet 提供程序。

现在系统上的先决条件已经设置完毕,让我们看看可让您连接到 Microsoft Entra 的 PowerShell 模块。

Microsoft Graph PowerShell 模块

Microsoft 提供了 Microsoft Graph PowerShell 模块来与 Microsoft Entra 交互。这是您需要安装和连接的唯一模块:

  • 安装 Microsoft Graph PowerShell 模块
  • 如何连接到 Microsoft Graph PowerShell

就是这样!

了解更多:安装 Exchange Online PowerShell 模块 »

结论

您学习了如何使用 PowerShell 连接到 Microsoft Entra。 Microsoft Graph PowerShell 模块是管理 Microsoft Entra 环境所需的唯一模块。

您喜欢这篇文章吗?您可能还喜欢安装和配置 Microsoft Entra Connect。不要忘记关注我们并分享这篇文章。

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯