Connect-IPPSSession

此 Cmdlet 僅適用于 Exchange Online PowerShell 模組。 如需詳細資訊,請參閱關於 Exchange Online PowerShell 模組

使用 Exchange Online PowerShell 模組中的 Connect-IPPSSession Cmdlet,使用新式驗證連線到安全 & 性合規性 PowerShell PowerShell。 Cmdlet 適用于 MFA 或未啟用 MFA 的帳戶。

注意:3.2.0 版或更新版本的模組支援大部分安全 & 性合規性 PowerShell Cmdlet 的 REST API 模式 (本機電腦上 WinRM 的基本驗證不需要 REST API 模式) 。 如需詳細資訊,請參閱Exchange Online PowerShell 模組的必要條件。

如需下方<語法>一節中參數集的詳細資訊,請參閱 Exchange Cmdlet 語法

Syntax

Connect-IPPSSession
       [[-ConnectionUri] <String>]
       [[-AzureADAuthorizationEndpointUri] <String>]
       [[-DelegatedOrganization] <String>]
       [[-PSSessionOption] <PSSessionOption>]
       [[-Prefix] <String>]
       [[-CommandName] <String[]>]
       [[-FormatTypeName] <String[]>]
       [-AppId <String>]
       [-BypassMailboxAnchoring]
       [-Certificate <X509Certificate2>]
       [-CertificateFilePath <String>]
       [-CertificatePassword <SecureString>]
       [-CertificateThumbprint <String>]
       [-Credential <PSCredential>]
       [-Organization <String>]
       [-UserPrincipalName <String>]
       [-UseRPSSession]
       [<CommonParameters>]

Description

如需詳細連線指示,包括必要條件,請 參閱連線到安全 & 性合規性 PowerShell

範例

範例 1

Connect-IPPSSession -UserPrincipalName michelle@contoso.onmicrosoft.com

此範例會使用指定的帳號和新式驗證連線到安全 & 性合規性 PowerShell,無論是否使用 MFA。 在模組的 v3.2.0 或更新版本中,我們會以 REST API 模式連線,因此本機電腦不需要 WinRM 中的基本驗證。

範例 2

Connect-IPPSSession -UserPrincipalName michelle@contoso.onmicrosoft.com -UseRPSSession

此範例會使用指定的帳號和新式驗證連線到安全 & 性合規性 PowerShell,無論是否使用 MFA。 在模組的 v3.2.0 或更新版本中,我們會以遠端 PowerShell 模式連線,因此本機電腦上需要 WinRM 的基本驗證。

範例 3

Connect-IPPSSession -AppId <%App_id%> -CertificateThumbprint <%Thumbprint string of certificate%> -Organization "contoso.onmicrosoft.com"

此範例會使用憑證指紋連線到自動腳本案例中的安全 & 性合規性 PowerShell。

範例 4

Connect-IPPSSession -AppId <%App_id%> -Certificate <%X509Certificate2 object%> -Organization "contoso.onmicrosoft.com"

此範例會使用憑證檔案連線到自動腳本案例中的安全 & 性合規性 PowerShell。 此方法最適合在遠端電腦中儲存憑證並在執行時間擷取的案例。 例如,憑證會儲存在 Azure 金鑰保存庫中。

參數

-AppId

AppId 參數會指定服務主體的應用程式識別碼,該服務主體用於憑證式驗證 (CBA) 。 有效的值是應用程式識別碼的 GUID (服務主體) 。 例如,36ee4c6c-0812-40a2-b820-b22ebd02bce3

如需詳細資訊,請參閱Exchange Online PowerShell 模組中自動腳本的僅限應用程式驗證

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-AzureADAuthorizationEndpointUri

AzureADAuthorizationEndpointUri 參數會指定可發出 OAuth2 存取權杖的 Azure AD 授權端點。 支援下列 PowerShell 環境和相關值:

  • Microsoft 365 或 Microsoft 365 GCC 中的安全 & 性合規性 PowerShell:請勿使用此參數。 必要的值是 https://login.microsoftonline.com/common ,但這也是預設值,因此您不需要使用此參數。
  • Office 365中由 21Vianet 運作的安全 & 性合規性 PowerShell:https://login.chinacloudapi.cn/common
  • Microsoft GCC High 或 Microsoft DoD 中的安全 & 性合規性 PowerShell: https://login.microsoftonline.us/common

如果您使用 UserPrincipalName 參數,則不需要在通常需要 AzureADAuthorizationEndpointUri 的環境中,針對 MFA 或同盟使用者使用 AzureADAuthorizationEndpointUri 參數, (需要 UserPrincipalName 或 AzureADAuthorizationEndpointUri;確定使用這兩個) 。

Type:String
Position:1
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-BypassMailboxAnchoring

BypassMailboxAnchoring 參數會略過信箱錨定提示的使用。 您不需要使用此參數指定值。

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-Certificate

Certificate 參數會指定用於憑證式驗證的憑證 (CBA) 。 有效的值是憑證的 X509Certificate2 物件值。

請勿將此參數與 CertificateFilePath 或 CertificateThumbprint 參數搭配使用。

如需 CBA 的詳細資訊,請參閱Exchange Online PowerShell 模組中自動腳本的僅限應用程式驗證

Type:X509Certificate2
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-CertificateFilePath

CertificateFilePath 參數會指定用於 CBA 的憑證。 有效的值是憑證檔案的完整公用路徑。 使用 CertificatePassword 參數搭配此參數。

請勿將此參數與 Certificate 或 CertificateThumbprint 參數搭配使用。

如需 CBA 的詳細資訊,請參閱Exchange Online PowerShell 模組中自動腳本的僅限應用程式驗證

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-CertificatePassword

當您使用 CertificateFilePath 參數來識別用於 CBA 的憑證時,CertificatePassword 參數會指定開啟憑證檔案所需的密碼。

您可以使用下列方法作為此參數的值:

  • (ConvertTo-SecureString -String '<password>' -AsPlainText -Force).
  • 執行此命令之前,請先將密碼儲存為變數 (例如 $password = Read-Host "Enter password" -AsSecureString ,) ,然後使用變數 ($password) 值。
  • (Get-Credential).password 當您執行此命令時,系統會提示您安全地輸入密碼。

如需 CBA 的詳細資訊,請參閱Exchange Online PowerShell 模組中自動腳本的僅限應用程式驗證

注意:使用 ConvertTo-SecureString 命令在本機儲存憑證的密碼,會使自動化案例的安全連線方法目的失敗。 使用 Get-Credential 命令來提示您安全地輸入憑證密碼,並不適用于自動化案例。 換句話說,實際上沒有自動化 安全的方式可以使用本機憑證進行連線。

Type:SecureString
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-CertificateThumbprint

CertificateThumbprint 參數會指定用於 CBA 的憑證。 有效的值是憑證的指紋值。 例如,83213AEAC56D61C97AEE5C1528F4AC5EBA7321C1

請勿將此參數與 Certificate 或 CertificateFilePath 參數搭配使用。

注意:只有 Microsoft Windows 才支援 CertificateThumbprint 參數。

如需 CBA 的詳細資訊,請參閱Exchange Online PowerShell 模組中自動腳本的僅限應用程式驗證

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-CommandName

CommandName 參數會指定要匯入會話的以逗號分隔的命令清單。 針對使用一組特定 Cmdlet 的應用程式或腳本,請使用此參數。 減少會話中的 Cmdlet 數目有助於改善效能,並減少應用程式或腳本的記憶體使用量。

Type:String[]
Position:5
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-ConnectionUri

ConnectionUri 參數會指定遠端 PowerShell 會話的連線端點。 支援下列 PowerShell 環境和相關值:

  • Microsoft 365 或 Microsoft 365 GCC 中的安全 & 性合規性 PowerShell:請勿使用此參數。 必要的值是 https://ps.compliance.protection.outlook.com/powershell-liveid/ ,但這也是預設值,因此您不需要使用此參數。
  • Office 365中由 21Vianet 運作的安全 & 性合規性 PowerShell:https://ps.compliance.protection.partner.outlook.cn/powershell-liveid
  • Microsoft GCC High 中的安全 & 性合規性 PowerShell: https://ps.compliance.protection.office365.us/powershell-liveid/
  • Microsoft DoD 中的安全 & 性合規性 PowerShell: https://l5.ps.compliance.protection.office365.us/powershell-liveid/
Type:String
Position:0
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-Credential

Credential 參數會指定用來連線到 Exchange Online PowerShell 的使用者名稱和密碼。 通常您會在指令碼中使用此參數,或在您必須提供具有必要權限的其他認證時使用此參數。 請勿針對使用多重要素驗證 (MFA) 的帳戶使用此參數。

執行 Connect-IPPSSession 命令之前,請先將使用者名稱和密碼儲存在變數 (例如 $UserCredential = Get-Credential ,) 。 然後,使用此參數的變數名稱 ($UserCredential) 。

Connect-IPPSSession命令完成之後,就會清空變數中的密碼金鑰。

Type:PSCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-DelegatedOrganization

DelegatedOrganization 參數會指定您想要管理的客戶組織 (例如,contosoelectronics.onmicrosoft.com) 。 只有在客戶組織已透過 CSP 計畫同意您委派的管理時,此參數才能運作。

成功驗證之後,此會話中的 Cmdlet 會對應至客戶組織,而此會話中的所有作業都會在客戶組織上完成。

附註

  • 使用委派組織的主要 .onmicrosoft.com 網域作為此參數的值。
  • 您必須使用 AzureADAuthorizationEndpointUri 參數搭配此參數。
Type:String
Position:2
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-FormatTypeName

FormatTypeName 參數會指定 Cmdlet 的輸出格式。

Type:String[]
Position:6
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-Organization

當您使用 CBA 連線時,Organization 參數會指定組織。 您必須使用組織的主要 .onmicrosoft.com 網域作為此參數的值。

如需 CBA 的詳細資訊,請參閱Exchange Online PowerShell 模組中自動腳本的僅限應用程式驗證

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-Prefix

當您連線時,Prefix 參數會指定要新增至安全 & 性合規性 PowerShell Cmdlet 名稱的文字值。 例如,當您針對這個參數使用 Contoso 值時,Get-ComplianceCase會變成Get-ContosoComplianceCase。

  • 前置詞值不能包含空格或特殊字元,例如底線或星號。
  • 您無法使用前置詞值 EXO。 該值會保留給模組內建的九個獨佔 Get-EXO* Cmdlet。
  • Prefix 參數只會影響匯入的安全 & 性合規性 Cmdlet 名稱。 它不會影響模組內建的 Cmdlet 名稱 (例如 Disconnect-ExchangeOnline) 。
Type:String
Position:4
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-PSSessionOption

PSSessionOption 參數會指定要在連線到安全 & 性合規性 PowerShell 時使用的遠端 PowerShell 會話選項。

New-PSSessionOption 命令的輸出儲存在變數 (例如 $PSOptions = New-PSSessionOption <Settings> ,) ,並使用變數名稱作為此參數的值 (例如 $PSOptions ,) 。

Type:PSSessionOption
Position:3
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-UserPrincipalName

UserPrincipalName 參數會指定您要用來連線 (的帳戶, navin@contoso.onmicrosoft.com 例如,) 。 使用此參數可讓您在系統提示您輸入密碼) (,略過在新式驗證認證提示中輸入使用者名稱。

如果您使用 UserPrincipalName 參數,則不需要在通常需要 AzureADAuthorizationEndpointUri 的環境中,針對 MFA 或同盟使用者使用 AzureADAuthorizationEndpointUri 參數, (需要 UserPrincipalName 或 AzureADAuthorizationEndpointUri;確定使用這兩個) 。

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online

-UseRPSSession

此參數可在模組的 3.2.0 版或更新版本中使用。

UseRPSSession 參數可讓您使用傳統遠端 PowerShell 存取所有 Cmdlet 來連線到安全 & 性合規性 PowerShell。 您不需要使用此參數指定值。

此參數需要在本機電腦的 WinRM 中啟用基本驗證。 如需詳細資訊, 請參閱在 WinRM 中開啟基本驗證

如果您未使用此參數,就不需要 WinRM 中的基本驗證。

Type:SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online