AD FS を使用してポータルに SAML 2.0 プロバイダーを構成する

注意

2022 年 10 月 12 日より、Power Apps ポータルは Power Pages となります。 詳細: Microsoft Power Pages の一般提供が開始されました (ブログ)
Power Apps ポータルのドキュメントは、近日中に Power Pages ドキュメントに移行、統合されます。

重要

Active Directory フェデレーション サービス (AD FS) を構成する手順は、ADFS サーバーのバージョンによって異なる場合があります。

AD FS 証明書利用者信頼を作成

注意

PowerShell スクリプトでこれらの手順を実行する方法については、後述の PowerShell を使用して AD FS を構成する を参照してください。

  1. AD FS 管理ツールを使い、サービス > クレームの説明へ進みます。

    1. クレーム内容を追加を選択します。

    2. 要求の指定:

      • 表示名:永続的な識別子

      • 要求の識別子:urn:oasis:names:tc:SAML:2.0:nameid-format:persistent

      • 有効化チェックボックス: このフェデレーション サービスが受け取ることができる要求の種類として、この要求の説明をフェデレーション メタデータで発行します。

      • 有効化チェックボックス: このフェデレーション サービスが送信できる要求の種類として、この要求の説明をフェデレーション メタデータで発行します。

    3. OK を選択します。

  2. AD FS 管理ツールを使用して、信頼関係 >証明書利用者の信頼を選択します。

    1. Relying Party Trust を追加を選択します。

    2. ようこそ: スタート画面の選択。

    3. データ ソースの選択: 依拠当事者に関するデータを手動で入力を選び、 を選択します。

    4. ディスプレイ名を指定: 名前 を入力し、 を選択します。 例: https://portal.contoso.com/

    5. プロファイルの選択: AD FS 2.0 プロファイルを選択し、次へを選択します。

    6. 証明書の構成: 次へを選択します。

    7. URL の構成: SAML 2.0 WebSSO プロトコールのサポートを有効化チェック ボックスを選択します。 証明書利用者のSAML 2.0 SSOサービスURL:https://portal.contoso.com/signin-saml2を入力する
      AD FS は、ポータルが HTTPS で動作することを要求していることに注意してください。

      注意

      結果のエンドポイントには、次の設定があります。

    8. IDの構成 : https://portal.contoso.com/ を入力し、追加を選択し、次へを選択します。 必要であれば、各証明書利用者ポータルに ID をさらに追加できます。 ユーザーは、利用可能な ID のいずれか、またはすべての ID を横断して認証することができます。

    9. 発行権限ルールの選択: 全てのユーザーが依存当事者にアクセスできるよう許可を選び、 を選択します。

    10. 信頼を追加する準備: 次へを選択します。

    11. クローズを選択します。

  3. 証明書利用者信頼に名前 ID 要求を追加します。

    Windows アカウント名を 名前 ID 要求へ変換 (入力方向の要求を変換):

    • 入力方向の要求の種類:Windows アカウント名

    • 出力方向の要求の種類: 名前 ID

    • 送信される名前 ID の形式: 永続的な識別子

    • すべての要求値をパス スルーする

SAML 2.0 プロバイダーの構成

AD FS 証明書利用者の信頼を設定した後は、ポータルに SAML 2.0 プロバイダーを構成する に記載の手順を実行できます。

ID プロバイダー–サインインを開始します

AD FS は、SAML 2.0 仕様ID プロバイダー–主導のシングルサインオン (SSO) プロファイルをサポートします。 ID プロバイダーが開始した SAML 要求に対して、ポータル (サービス プロバイダー) が適切に応答するには、RelayState パラメーターが適切にエンコードされている必要があります。

SAML RelayState パラメーターにエンコードされる基本文字列値は、次の形式でなければなりません : [ReturnUrl=/content/sub-content/] この /content/sub-content/ は、ポータル (サービス プロバイダー) でナビゲーションする Web ページへのパスですを表わします。 パスは、ポータルでの任意の有効な Web ページで置き換えることができます。 文字列値がエンコードされ、次の形式でコンテナ文字列の中に配置されます : RPID=&lt;URL encoded RPID&gt;&RelayState=&lt;URL encoded RelayState&gt; 。 全体の文字列はさらにエンコードされ、次の形式で別のコンテナに追加されます : <https://adfs.contoso.com/adfs/ls/idpinitiatedsignon.aspx?RelayState=&lt;URL> encoded RPID/RelayState&gt;

たとえば、サービス プロバイダーのパスが /content/sub-content/ であり、証明書利用者 ID が https://portal.contoso.com/ の場合、次の手順で URL が構築されます :

  • ReturnUrl=/content/sub-content/ をエンコードして、 ReturnUrl%3D%2Fcontent%2Fsub-content%2F を取得する

  • https://portal.contoso.com/ をエンコードして、 https%3A%2F%2Fportal.contoso.com%2F を取得する

  • RPID=https%3A%2F%2Fportal.contoso.com%2F&RelayState=ReturnUrl%3D%2Fcontent%2Fsub-content%2F をエンコードして、 RPID%3Dhttps%253A%252F%252Fportal.contoso.com%252F%26RelayState%3DReturnUrl%253D%252Fcontent%252Fsub-content%252F を取得する

  • AD FS のID プロバイダーで開始された SSO–パスを追加して、最終的な URL を取得します : https://adfs.contoso.com/adfs/ls/idpinitiatedsignon.aspx?RelayState=RPID%3Dhttps%253A%252F%252Fportal.contoso.com%252F%26RelayState%3DReturnUrl%253D%252Fcontent%252Fsub-content%252F

以下の PowerShell のスクリプトを使用して URL を構築します。 スクリプトを Get-IdPInitiatedUrl.ps1 という名前のファイルに保存します。

<#

.SYNOPSIS 

Constructs an IdP-initiated SSO URL to access a portal page on the service provider.

.PARAMETER path

The path to the portal page.

.PARAMETER rpid

The relying party identifier.

.PARAMETER adfsPath

The AD FS IdP initiated SSO page.

.EXAMPLE

PS C:\\> .\\Get-IdPInitiatedUrl.ps1 -path "/content/sub-content/" -rpid "https://portal.contoso.com/" -adfsPath "https://adfs.contoso.com/adfs/ls/idpinitiatedsignon.aspx"

#>

param

(

[parameter(mandatory=$true,position=0)]

$path,

[parameter(mandatory=$true,position=1)]

$rpid,

[parameter(position=2)]

$adfsPath = https://adfs.contoso.com/adfs/ls/idpinitiatedsignon.aspx

)

$state = ReturnUrl=$path

$encodedPath = [uri]::EscapeDataString($state)

$encodedRpid = [uri]::EscapeDataString($rpid)

$encodedPathRpid = [uri]::EscapeDataString("RPID=$encodedRpid&RelayState=$encodedPath")

$idpInitiatedUrl = {0}?RelayState={1} -f $adfsPath, $encodedPathRpid

Write-Output $idpInitiatedUrl

PowerShell を使用した AD FS の構成

AD FS に証明書利用者の信頼を追加するプロセスは、AD FS サーバ上で以下の PowerShell スクリプトを実行することでも実行できます。 スクリプトを Add-AdxPortalRelyingPartyTrustForSaml.ps1 という名前のファイルに保存します。 スクリプトの実行後、ポータル サイト設定の構成を続行します。

<# 

.SYNOPSIS

Adds a SAML 2.0 relying party trust entry for a website.

.PARAMETER domain

The domain name of the portal.

.EXAMPLE

PS C:\\> .\\Add-AdxPortalRelyingPartyTrustForSaml.ps1 -domain portal.contoso.com

#>

param

(

[parameter(Mandatory=$true,Position=0)]

$domain,

[parameter(Position=1)]

$callbackPath = /signin-saml2

)

$VerbosePreference = Continue

$ErrorActionPreference = Stop

Import-Module adfs

Function Add-CrmRelyingPartyTrust

{

param (

[parameter(Mandatory=$true,Position=0)]

$name

)

$identifier = https://{0}/ -f $name

$samlEndpoint = New-ADFSSamlEndpoint -Binding POST -Protocol SAMLAssertionConsumer -Uri (https://{0}{1} -f $name, $callbackPath)

$identityProviderValue = Get-ADFSProperties | % { $_.Identifier.AbsoluteUri }

$issuanceTransformRules = @'

@RuleTemplate = MapClaims

@RuleName = Transform [!INCLUDE[pn-ms-windows-short](../../../includes/pn-ms-windows-short.md)] Account Name to Name ID claim

c:[Type == "https://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname"]

=> issue(Type = "https://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", Issuer = c.Issuer, OriginalIssuer = c.OriginalIssuer, Value = c.Value, ValueType = c.ValueType, Properties["https://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/format"] = "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent");

@RuleTemplate = LdapClaims

@RuleName = Send LDAP Claims

c:[Type == "https://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname", Issuer == "AD AUTHORITY"]

=> issue(store = "[!INCLUDE[pn-active-directory](../../../includes/pn-active-directory.md)]", types = ("https://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname", "https://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname", "https://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"), query = ";givenName,sn,mail;{{0}}", param = c.Value);

'@ -f $identityProviderValue

$issuanceAuthorizationRules = @'

@RuleTemplate = AllowAllAuthzRule

=> issue(Type = https://schemas.microsoft.com/authorization/claims/permit, Value = true);

'@

Add-ADFSRelyingPartyTrust -Name $name -Identifier $identifier -SamlEndpoint $samlEndpoint -IssuanceTransformRules $issuanceTransformRules -IssuanceAuthorizationRules $issuanceAuthorizationRules

}

# add the 'Identity Provider' claim description if it is missing


[!INCLUDE[cc-pages-ga-banner](../../../includes/cc-pages-ga-banner.md)]

if (-not (Get-ADFSClaimDescription | ? { $_.Name -eq Persistent Identifier })) {

Add-ADFSClaimDescription -name "Persistent Identifier" -ClaimType "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent" -IsOffered:$true -IsAccepted:$true

}

# add the portal relying party trust


[!INCLUDE[cc-pages-ga-banner](../../../includes/cc-pages-ga-banner.md)]

Add-CrmRelyingPartyTrust $domain

SAML 2.0 プロバイダーの構成

AD FS 証明書利用者の信頼を設定した後は、SAML 2.0 プロバイダーを構成するに記載の手順を実行できます。

参照

Azure AD を使用してポータルに SAML 2.0 プロバイダーを構成する
ポータルで SAML 2.0 を使用するにあたっての FAQ
ポータルの SAML 2.0 プロバイダーを構成する

注意

ドキュメントの言語設定についてお聞かせください。 簡単な調査を行います。 (この調査は英語です)

この調査には約 7 分かかります。 個人データは収集されません (プライバシー ステートメント)。