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

[玩转系统] 使用 Connect-IPPSSession 连接到安全与合规性 PowerShell

作者:精品下载站 日期:2024-12-14 05:53:32 浏览:14 分类:玩电脑

使用 Connect-IPPSSession 连接到安全与合规性 PowerShell


若要使用 PowerShell 连接到 Microsoft Defender 和 Microsoft Purview 合规性门户,需要使用 Exchange Online 中的 Connect-IPPSSession cmdlet。在本文中,您将了解如何使用 Connect-IPPSSession PowerShell cmdlet 连接到安全与合规中心。

如何连接到安全与合规性 PowerShell

执行运行 Connect-IPPSSession PowerShell cmdlet 所需的以下步骤。

1.安装Exchange在线管理模块

在开始之前,您需要安装 Exchange Online PowerShell 模块。

您可以通过以下方式安装 Exchange Online 管理模块:

  1. PowerShell获取
  2. PS资源获取

方法1.使用PowerShellGet

运行以下 PowerShell 命令来安装 Exchange Online 管理模块。

Install-Module -Name ExchangeOnlineManagement -Force

方法 2. 使用 Microsoft PowerShell PSResourceGet

运行 Install-PSResource cmdlet 以安装 Exchange Online 管理模块。

Install-PSResource -Name ExchangeOnlineManagement -Force

2. 连接到 Exchange Online PowerShell

要运行 PowerShell 命令,您必须连接到 Exchange Online PowerShell。

以管理员身份启动 Windows PowerShell 并运行 Connect-ExchangeOnline cmdlet。

Connect-ExchangeOnline

使用您的管理员凭据登录,无论是否启用了 MFA。

成功登录后,PowerShell 输出显示以下内容。

This V3 EXO PowerShell module contains new REST API backed Exchange Online cmdlets which doesn't require WinRM for Client-Server communication. You can now run these cmdlets after turning off WinRM Basic Auth in your client machine thus making it more secure. 

Unlike the EXO* prefixed cmdlets, the cmdlets in this module support full functional parity with the RPS (V1) cmdlets.

V3 cmdlets in the downloaded module are resilient to transient failures, handling retries and throttling errors inherently. 

REST backed EOP and SCC cmdlets are also available in the V3 module. Similar to EXO, the cmdlets can be run without WinRM basic auth enabled. 

For more information check https://aka.ms/exov3-module

3. 连接到安全与合规性 PowerShell

然后,您需要再次连接并运行 Connect-IPPSSession PowerShell cmdlet。

Connect-IPPSSession

使用您的管理员凭据登录,无论启用或未启用 MFA。

PowerShell 输出显示以下结果。

We have made updates to move the SCC admin experience to REST-based APIs. In doing so, we will be deprecating the legacy Remote PowerShell (RPS) protocol starting July 15, 2023.

Benefits of REST-based cmdlets: improved security, WinRM no longer required for client-server communication, improved error handling.

The REST API has the same cmdlets available and feature parity with RPS(V1) cmdlets, so existing scripts and processes don't need to be updated. Simply using the new module will ensure REST is used rather than RPS.

For more information, go to https://aka.ms/exov3-module

现在,您已连接到安全与合规性 PowerShell。

注意:如果某些 PowerShell 命令仍然不起作用,则意味着您没有所需的权限。你可以在 Microsoft Defender 门户或 Microsoft Purview 合规门户中检查权限和角色。

Connect-IPPSSession cmdlet 错误

要使用 REST API 通过 Connect-IPPSSession 连接到安全与合规中心,您需要 EXO 3.2.0 及更高版本。

如果您没有 Exchange Online 管理模块 3.2.0 或更高版本,则在运行 Connect-IPPSSession cmdlet 时将会收到以下警告。

警告:您的连接已重定向到以下 URI:“https://eur06b.ps.compliance.protection.outlook.com/Powershell-LiveId?BasicAuthToOAuthConversion=true;PSVersion=7.4.1”

当您运行以下 cmdlet 时,您将收到错误消息。

New-ComplianceSearch -Name "Test Mailbox" -ExchangeLocation "[email protected]"

New-ComplianceSearch:术语“New-ComplianceSearch”不被识别为 cmdlet、函数、脚本文件或可执行程序的名称。检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。

如何修复 Connect-IPPSSession cmdlet 错误

要修复 PowerShell 中的 Connect-IPPSSession 错误,请按照以下步骤操作。

检查 Exchange Online 管理模块版本

有两种方法可以检查您安装的 EXO 版本,具体取决于您安装 Exchange Online Management 的方式。

方法一:使用Get-module

要检查是否有最新的 EXO 模块,请运行 Get-Module PowerShell cmdlet。

Get-Module -Name ExchangeOnlineManagement | Format-Table -Property Name, Version, ModuleType

PowerShell 输出显示 ExchangeOnlineManagement 模块的版本。

Name                     Version ModuleType
----                     ------- ----------
ExchangeOnlineManagement 3.4.0       Script

方法 2:使用 Get-InstalledPSResource

要检查是否有最新的 EXO 模块,请运行 Get-InstalledPSResource PowerShell cmdlet。

Get-InstalledPSResource -Scope AllUsers

它显示了 ExchangeOnlineManagement 和您已安装的其他模块的列表。

Name                     Version Prerelease Repository Description
----                     ------- ---------- ---------- -----------
ExchangeOnlineManagement 3.4.0              PSGallery  This is a General Availability (GA) release of the Exchange Online Powershell V3 module.
Microsoft.Graph          2.12.0             PSGallery  Microsoft Graph PowerShell module

更新 Exchange Online 管理模块

如果您已经安装了Exchange Online模块,则只需更新它即可。请始终更新最新的 Exchange Online 管理模块以运行 Connect-IPPSSession cmdlet。

注意:如果更新不起作用,请删除 Exchange Online 管理模块并退出所有 PowerShell 会话。接下来,启动 PowerShell 并安装 Exchange Online PowerShell 模块。

有两种方法可以更新 Exchange Online 管理模块,具体取决于您的安装方式。

方法一:使用PowerShellGet

要将 Exchange Online 模块更新到最新版本,请运行以下 PowerShell 命令。

Update-Module -Name ExchangeOnlineManagement -Force

方法 2:使用 Microsoft PowerShell PSResource

运行以下 PowerShell 命令以更新到最新版本的 Exchange Online 模块。

Install-PSResource ExchangeOnlineManagement -Reinstall -Scope AllUsers -TrustRepository

就是这样!

了解更多:安装 Microsoft Graph PowerShell 模块»

结论

您了解了如何在 Exchange Online PowerShell 中使用 Connect-IPPSSession cmdlet。您必须在 PowerShell 中安装并更新最新的 Exchange Online 管理模块版本。否则,在运行 Connect-IPPSSession cmdlet 时将会出现错误。

您喜欢这篇文章吗?您可能还喜欢连接到 Microsoft Graph PowerShell。不要忘记关注我们并分享这篇文章。

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

取消回复欢迎 发表评论:

关灯