Microsoft Graph を使用してアプリケーションの SAML ベースのシングル サインオンを構成する

シングル サインオン (SSO) は、ユーザーが 1 つのアプリケーションにサインインし、もう一度サインインしなくても複数のアプリケーションにアクセスできるようにする認証方法です。 Microsoft Entraでは、OpenID Connect、OAuth、セキュリティ アサーション マークアップ言語 (SAML)、パスワードベース、リンクされた SSO など、さまざまな SSO メソッドがサポートされています。 Microsoft Graph を使用すると、アプリケーションの SSO の構成を自動化できます。

このチュートリアルでは、以下を実行する方法について説明します。

  • Microsoft Entra ギャラリーで SAML ベースのアプリを識別し、アプリの SAML ベースの SSO を構成する
  • アプリケーションにアプリ ロールを追加し、ユーザーに付与する
  • SAML トークンで出力する要求を構成する
  • フェデレーション SSO の証明書を構成する
  • 統合を完了するために使用するアプリケーションのMicrosoft Entra ID SAML メタデータを取得する

前提条件

  • Microsoft Entra テナントで Cloud Application Administrator ロールを持つユーザーとして Graph エクスプローラー などの API クライアントにサインインします。
  • 委任されたアクセス許可を自分に付与します: Application.ReadWrite.AllAppRoleAssignment.ReadWrite.AllPolicy.Read.AllPolicy.ReadWrite.ApplicationConfiguration、および User.ReadWrite.All
  • アプリケーションに割り当てるテスト ユーザーがいます。

手順 1: 構成するアプリケーションを特定する

Microsoft Entra IDには、アプリケーションのテンプレートとして使用できる数千もの事前に設定されたアプリケーションを含むギャラリーがあります。 Microsoft Graph では、この一覧は applicationTemplate エンティティから入手できます。

この手順では、構成するアプリケーションの AWS IAM Identity Center (successor to AWS Single Sign-On) アプリケーション テンプレートを特定します。 ID を記録します

要求

GET https://graph.microsoft.com/v1.0/applicationTemplates?$filter=displayName eq 'AWS IAM Identity Center (successor to AWS Single Sign-On)'

応答

HTTP/1.1 200 OK
Content-type: application/json

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#applicationTemplates",
    "@microsoft.graph.tips": "Use $select to choose only the properties your app needs, as this can lead to performance improvements. For example: GET applicationTemplates?$select=categories,description",
    "value": [
        {
            "id": "21ed01d2-ec13-4e9e-86c1-cd546719ebc4",
            "displayName": "AWS IAM Identity Center (successor to AWS Single Sign-On)",
            "homePageUrl": "https://aws.amazon.com/",
            "supportedSingleSignOnModes": [
                "saml",
                "external"
            ],
            "supportedProvisioningTypes": [
                "sync"
            ],
            "logoUrl": "https://galleryapplogos1.azureedge.net/app-logo/awssinglesignon_FC86917E_215.png",
            "categories": [
                "developerServices",
                "itInfrastructure",
                "security",
                "New"
            ],
            "publisher": "Amazon Web Services, Inc.",
            "description": "Federate once to AWS IAM Identity Center (successor to AWS Single Sign-On) & use it to centrally manage access to multiple AWS accounts and IAM Identity Center enabled apps. Provision users via SCIM."
        }
    ]
}

手順 2: アプリケーションをインスタンス化する

アプリケーション テンプレートの id 値を使用して、テナントにアプリケーションのインスタンスを作成します。 ここでは、アプリケーションに AWS Contoso という名前を 付けます。 応答には、 AWS Contoso のアプリケーションとサービス プリンシパル オブジェクトが含まれます。これは 、AWS IAM Identity Center (AWS シングル サインオンの後継) アプリのインスタンスです。 このチュートリアルの後半で使用するために、2 つのオブジェクトの ID を記録します。

要求

POST https://graph.microsoft.com/v1.0/applicationTemplates/21ed01d2-ec13-4e9e-86c1-cd546719ebc4/instantiate
Content-type: application/json

{
  "displayName": "AWS Contoso"
}

応答

HTTP/1.1 201 Created
Content-type: application/json

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.applicationServicePrincipal",
    "application": {
        "id": "b7308000-8bb3-467b-bfc7-8dbbfd759ad9",
        "appId": "2fbc8259-0f56-4f56-9870-93a228020936",
        "applicationTemplateId": "21ed01d2-ec13-4e9e-86c1-cd546719ebc4",
        "createdDateTime": "2024-02-21T17:14:33Z",
        "deletedDateTime": null,
        "displayName": "AWS Contoso",
        "description": null,
        "groupMembershipClaims": null,
        "identifierUris": [],
        "isFallbackPublicClient": false,
        "signInAudience": "AzureADMyOrg",
        "tags": [],
        "tokenEncryptionKeyId": null,
        "defaultRedirectUri": null,
        "samlMetadataUrl": null,
        "optionalClaims": null,
        "addIns": [],
        "api": {
            "acceptMappedClaims": null,
            "knownClientApplications": [],
            "requestedAccessTokenVersion": null,
            "oauth2PermissionScopes": [
                {
                    "adminConsentDescription": "Allow the application to access AWS Contoso on behalf of the signed-in user.",
                    "adminConsentDisplayName": "Access AWS Contoso",
                    "id": "f5419931-094d-481d-b801-ab3ed60d48d8",
                    "isEnabled": true,
                    "type": "User",
                    "userConsentDescription": "Allow the application to access AWS Contoso on your behalf.",
                    "userConsentDisplayName": "Access AWS Contoso",
                    "value": "user_impersonation"
                }
            ],
            "preAuthorizedApplications": []
        },
        "appRoles": [
            {
                "allowedMemberTypes": [
                    "User"
                ],
                "displayName": "User",
                "id": "8774f594-1d59-4279-b9d9-59ef09a23530",
                "isEnabled": true,
                "description": "User",
                "value": null,
                "origin": "Application"
            },
            {
                "allowedMemberTypes": [
                    "User"
                ],
                "displayName": "msiam_access",
                "id": "e7f1a7f3-9eda-48e0-9963-bd67bf531afd",
                "isEnabled": true,
                "description": "msiam_access",
                "value": null,
                "origin": "Application"
            }
        ],
        "info": {
            "logoUrl": null,
            "marketingUrl": null,
            "privacyStatementUrl": null,
            "supportUrl": null,
            "termsOfServiceUrl": null
        },
        "keyCredentials": [],
        "parentalControlSettings": {
            "countriesBlockedForMinors": [],
            "legalAgeGroupRule": "Allow"
        },
        "passwordCredentials": [],
        "publicClient": {
            "redirectUris": []
        },
        "requiredResourceAccess": [],
        "verifiedPublisher": {
            "displayName": null,
            "verifiedPublisherId": null,
            "addedDateTime": null
        },
        "web": {
            "homePageUrl": "https://*.signin.aws.amazon.com/platform/saml/acs/*?metadata=awssinglesignon|ISV9.1|primary|z",
            "redirectUris": [
                "https://*.signin.aws.amazon.com/platform/saml/acs/*"
            ],
            "logoutUrl": null
        }
    },
    "servicePrincipal": {
        "id": "d3616293-fff8-4415-9f01-33b05dad1b46",
        "deletedDateTime": null,
        "accountEnabled": true,
        "appId": "2fbc8259-0f56-4f56-9870-93a228020936",
        "applicationTemplateId": "21ed01d2-ec13-4e9e-86c1-cd546719ebc4",
        "appDisplayName": "AWS Contoso",
        "alternativeNames": [],
        "appOwnerOrganizationId": "38d49456-54d4-455d-a8d6-c383c71e0a6d",
        "displayName": "AWS Contoso",
        "appRoleAssignmentRequired": true,
        "loginUrl": null,
        "logoutUrl": null,
        "homepage": "https://*.signin.aws.amazon.com/platform/saml/acs/*?metadata=awssinglesignon|ISV9.1|primary|z",
        "notificationEmailAddresses": [],
        "preferredSingleSignOnMode": null,
        "preferredTokenSigningKeyThumbprint": null,
        "replyUrls": [],
        "servicePrincipalNames": [
            "2fbc8259-0f56-4f56-9870-93a228020936"
        ],
        "servicePrincipalType": "Application",
        "tags": [
            "WindowsAzureActiveDirectoryIntegratedApp"
        ],
        "tokenEncryptionKeyId": null,
        "samlSingleSignOnSettings": null,
        "addIns": [],
        "appRoles": [
            {
                "allowedMemberTypes": [
                    "User"
                ],
                "displayName": "User",
                "id": "8774f594-1d59-4279-b9d9-59ef09a23530",
                "isEnabled": true,
                "description": "User",
                "value": null,
                "origin": "Application"
            },
            {
                "allowedMemberTypes": [
                    "User"
                ],
                "displayName": "msiam_access",
                "id": "e7f1a7f3-9eda-48e0-9963-bd67bf531afd",
                "isEnabled": true,
                "description": "msiam_access",
                "value": null,
                "origin": "Application"
            }
        ],
        "info": {
            "logoUrl": null,
            "marketingUrl": null,
            "privacyStatementUrl": null,
            "supportUrl": null,
            "termsOfServiceUrl": null
        },
        "keyCredentials": [],
        "oauth2PermissionScopes": [
            {
                "adminConsentDescription": "Allow the application to access AWS Contoso on behalf of the signed-in user.",
                "adminConsentDisplayName": "Access AWS Contoso",
                "id": "f5419931-094d-481d-b801-ab3ed60d48d8",
                "isEnabled": true,
                "type": "User",
                "userConsentDescription": "Allow the application to access AWS Contoso on your behalf.",
                "userConsentDisplayName": "Access AWS Contoso",
                "value": "user_impersonation"
            }
        ],
        "passwordCredentials": [],
        "verifiedPublisher": {
            "displayName": null,
            "verifiedPublisherId": null,
            "addedDateTime": null
        }
    }
}

手順 3: シングル サインオンを構成する

この手順では、AWS Contoso アプリケーションとサービス プリンシパルの両方に SSO を構成します。 アプリケーションの場合は、サービス プリンシパルに対して SAML URL を構成し、SSO モードを に saml設定します。

手順 3.1: サービス プリンシパルのシングル サインオン モードを設定する

手順 2 で作成したサービス プリンシパルの SSO モードとして設定 saml します。 要求は、204 No Content 応答コードを返します。

PATCH https://graph.microsoft.com/v1.0/servicePrincipals/d3616293-fff8-4415-9f01-33b05dad1b46
Content-type: application/json

{
  "preferredSingleSignOnMode": "saml"
}

手順 3.2: アプリケーションの基本的な SAML URL を設定する

この手順では、手順 2 で作成したアプリケーションの Web/redirectUrisWeb/redirectUris を設定します。 要求は、204 No Content 応答コードを返します。

PATCH https://graph.microsoft.com/v1.0/applications/b7308000-8bb3-467b-bfc7-8dbbfd759ad9
Content-type: application/json

{
    "identifierUris": [
        "https://signin.aws.amazon.com/saml"
    ],
    "web": {
        "redirectUris": [
            "https://signin.aws.amazon.com/saml"
        ]
    }
}

手順 4: アプリ ロールを追加する

アプリケーションがトークンの中に役割情報を必要とする場合、アプリケーション オブジェクトに役割の定義を追加します。 既定では、手順 2 のアプリケーションとサービス プリンシパルの appRoles オブジェクトには、既定 Usermsiam_access ロールが含まれていました。 変更または削除しないでください。 モード ロールを追加するには、要求に既存のロールと新しいロールの両方を appRoles オブジェクトに含める必要があります。それ以外の場合は、既存のロールが置き換えられます。

この手順では、ロールと Admin,WAAD ロールを AWS Contoso サービス プリンシパルに追加Finance,WAADします。 要求は、204 No Content 応答コードを返します。

PATCH https://graph.microsoft.com/v1.0/servicePrincipals/d3616293-fff8-4415-9f01-33b05dad1b46
Content-type: application/json

{
    "appRoles": [
        {
            "allowedMemberTypes": [
                "User"
            ],
            "description": "User",
            "displayName": "User",
            "id": "8774f594-1d59-4279-b9d9-59ef09a23530",
            "isEnabled": true,
            "origin": "Application",
            "value": null
        },
        {
            "allowedMemberTypes": [
                "User"
            ],
            "description": "msiam_access",
            "displayName": "msiam_access",
            "id": "e7f1a7f3-9eda-48e0-9963-bd67bf531afd",
            "isEnabled": true,
            "origin": "Application",
            "value": null
        },
        {
            "allowedMemberTypes": [
                "User"
            ],
            "description": "Admin,WAAD",
            "displayName": "Admin,WAAD",
            "id": "3a84e31e-bffa-470f-b9e6-754a61e4dc63",
            "isEnabled": true,
            "value": "arn:aws:iam::212743507312:role/accountname-aws-admin,arn:aws:iam::212743507312:saml-provider/WAAD"
        },
        {
            "allowedMemberTypes": [
                "User"
            ],
            "description": "Finance,WAAD",
            "displayName": "Finance,WAAD",
            "id": "7a960000-ded3-455b-8c04-4f2ace00319b",
            "isEnabled": true,
            "value": "arn:aws:iam::212743507312:role/accountname-aws-finance,arn:aws:iam::212743507312:saml-provider/WAAD"
        }
    ]
}

手順 5: 要求マッピングを構成する

MICROSOFT ENTRA ID フィールドを特定の AWS IAM Identity Center アプリケーション属性にマッピングして、SAML 属性を構成する必要があります。 そのため、要求マッピング ポリシーを作成し、サービス プリンシパルに割り当てます。

手順 5.1: 要求マッピング ポリシーを作成する

基本的な要求に加えて、SAML トークンで出力するMicrosoft Entra IDに対して次の要求を構成します。

要求の名前 ソース
https://aws.amazon.com/SAML/Attributes/Role assignedroles
https://aws.amazon.com/SAML/Attributes/RoleSessionName userprincipalname
https://aws.amazon.com/SAML/Attributes/SessionDuration "900"
appRoles assignedroles
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier userprincipalname

注:

クレーム マッピング ポリシーの一部のキー ( バージョンなど) では、大文字と小文字が区別されます。 "プロパティに無効な値があります" というエラー メッセージが、大文字と小文字の区別の問題である可能性があります。

このチュートリアルの後半で使用するために、要求マッピング ポリシーを作成し、その ID を記録します。

要求

POST https://graph.microsoft.com/v1.0/policies/claimsMappingPolicies
Content-type: application/json

{
    "definition": [
        "{\"ClaimsMappingPolicy\":{\"Version\":1,\"IncludeBasicClaimSet\":\"true\", \"ClaimsSchema\": [{\"Source\":\"user\",\"ID\":\"assignedroles\",\"SamlClaimType\": \"https://aws.amazon.com/SAML/Attributes/Role\"}, {\"Source\":\"user\",\"ID\":\"userprincipalname\",\"SamlClaimType\": \"https://aws.amazon.com/SAML/Attributes/RoleSessionName\"}, {\"Value\":\"900\",\"SamlClaimType\": \"https://aws.amazon.com/SAML/Attributes/SessionDuration\"}, {\"Source\":\"user\",\"ID\":\"assignedroles\",\"SamlClaimType\": \"appRoles\"}, {\"Source\":\"user\",\"ID\":\"userprincipalname\",\"SamlClaimType\": \"https://aws.amazon.com/SAML/Attributes/nameidentifier\"}]}}"
    ],
    "displayName": "AWS Claims Policy",
    "isOrganizationDefault": false
}

応答

HTTP/1.1 201 Created
Content-type: application/json

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#policies/claimsMappingPolicies/$entity",
    "id": "92037c7a-a875-49a0-814e-8ec30f880e2e",
    "deletedDateTime": null,
    "definition": [
        "{\"ClaimsMappingPolicy\":{\"Version\":1,\"IncludeBasicClaimSet\":\"true\", \"ClaimsSchema\": [{\"Source\":\"user\",\"ID\":\"assignedroles\",\"SamlClaimType\": \"https://aws.amazon.com/SAML/Attributes/Role\"}, {\"Source\":\"user\",\"ID\":\"userprincipalname\",\"SamlClaimType\": \"https://aws.amazon.com/SAML/Attributes/RoleSessionName\"}, {\"Value\":\"900\",\"SamlClaimType\": \"https://aws.amazon.com/SAML/Attributes/SessionDuration\"}, {\"Source\":\"user\",\"ID\":\"assignedroles\",\"SamlClaimType\": \"appRoles\"}, {\"Source\":\"user\",\"ID\":\"userprincipalname\",\"SamlClaimType\": \"https://aws.amazon.com/SAML/Attributes/nameidentifier\"}]}}"
    ],
    "displayName": "AWS Claims Policy",
    "isOrganizationDefault": false
}

手順 5.2: 要求マッピング ポリシーをサービス プリンシパルに割り当てる

要求は、204 No Content 応答コードを返します。

POST https://graph.microsoft.com/v1.0/servicePrincipals/ef04fead-8549-4e59-b5f7-d1d8c697ec64/claimsMappingPolicies/$ref
Content-type: application/json

{
    "@odata.id": "https://graph.microsoft.com/v1.0/policies/claimsMappingPolicies/92037c7a-a875-49a0-814e-8ec30f880e2e"
}

手順 6: 署名証明書を構成する

SAML 応答の署名Microsoft Entra ID使用できる証明書が必要です。 エンドポイントを /addTokenSigningCertificate 使用して、 サービス プリンシパルのトークン署名証明書を作成できます。 または、 自己署名証明書を作成し、サービス プリンシパルにアップロードすることもできます。

証明書を追加すると、サービス プリンシパルには keyCredentials コレクションに 2 つのオブジェクト (秘密キー用と公開キー用の 1 つ) が含まれます。証明書 パスワードの passwordCredentials コレクション内の オブジェクト。

オプション 1: サービス プリンシパルのトークン署名証明書を作成する

要求

POST https://graph.microsoft.com/v1.0/servicePrincipals/d3616293-fff8-4415-9f01-33b05dad1b46/addTokenSigningCertificate
Content-type: application/json

{
    "displayName": "CN=AWSContoso",
    "endDateTime": "2027-01-22T00:00:00Z"
}

応答

HTTP/1.1 200 OK
Content-type: application/json

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.selfSignedCertificate",
    "customKeyIdentifier": "wt3YBEyVas0CaadaZLeGLbndrD4=",
    "displayName": "CN=AWSContoso",
    "endDateTime": "2027-01-22T00:00:00Z",
    "key": "MIICqjCCAZKgAwIBAgIIZYCy..KlDixjUT61i4tFs=",
    "keyId": "04e5ac4e-31f9-41ad-83e2-6dd41e1d81f4",
    "startDateTime": "2024-02-21T17:09:35.0006942Z",
    "thumbprint": "C2DDD8044C956ACD0269A75A64B7862DB9DDAC3E",
    "type": "AsymmetricX509Cert",
    "usage": "Verify"
}

オプション 2: カスタム署名証明書を作成する

次の PowerShell スクリプトと C# スクリプトを使用して、テスト用の自己署名証明書を取得できます。 会社のベスト セキュリティ プラクティスを使用して、運用環境用の署名証明書を作成します。

次のスクリプトは、プロンプトが表示されたときに指定した名前の fqdn 自己署名証明書を作成します (例: CN=AWSContoso)。 指定したパスワードを使用して証明書を保護し、 で pwd 指定 locationした場所に PFX 証明書と CER 証明書をエクスポートします。

Param(
    [Parameter(Mandatory=$true)]
    [string]$fqdn,
    [Parameter(Mandatory=$true)]
    [string]$pwd,
    [Parameter(Mandatory=$true)]
    [string]$location
) 

if (!$PSBoundParameters.ContainsKey('location'))
{
    $location = "."
} 

$cert = New-SelfSignedCertificate -certstorelocation cert:\currentuser\my -DnsName $fqdn
$pwdSecure = ConvertTo-SecureString -String $pwd -Force -AsPlainText
$path = 'cert:\currentuser\my\' + $cert.Thumbprint
$cerFile = $location + "\\" + $fqdn + ".cer"
$pfxFile = $location + "\\" + $fqdn + ".pfx" 

Export-PfxCertificate -cert $path -FilePath $pfxFile -Password $pwdSecure
Export-Certificate -cert $path -FilePath $cerFile

証明書の詳細を抽出する

前の手順では、CER 証明書と PFX 証明書があります。 サービス プリンシパルに追加する秘密キー、パスワード、公開キー、証明書の拇印の値を抽出します。

証明書の拇印を抽出する
要求

次の PowerShell スクリプトを使用すると、CER ファイルから拇印を抽出できます。 ファイル パスを証明書の場所に置き換えます。

## Replace the file path with the source of your certificate

Get-PfxCertificate -Filepath "C:\Users\admin\Desktop\CN=AWSContoso.cer" | Out-File -FilePath "C:\Users\admin\Desktop\CN=AWSContoso.cer.thumbprint.txt"
応答

CN=AWSContoso.cer.thumbprint.txt ファイルには、次の出力のようなエントリがあります。

Thumbprint                                Subject              EnhancedKeyUsageList
----------                                -------              --------------------
5214D6BA9438F984A0CC2C856CCEA6A76EDCEC3A  CN=AWSContoso        {Client Authentication, Server Authentication}
証明書キーを抽出する

次の PowerShell スクリプトを使用すると、CER ファイルから公開キーを抽出できます。 ファイル パスを証明書の場所に置き換えます。

要求
[convert]::ToBase64String((Get-Content C:\Users\admin\Desktop\CN=AWSContoso.cer -AsByteStream -Raw))  | Out-File -FilePath "C:\Users\admin\Desktop\CN=AWSContoso.cer.key.txt"
応答

CN=AWSContoso.cer.key.txt ファイルには、次の切り捨てられた出力のような base64 でエンコードされた値があります。

MIIDHjCCAgagAwIBAgIQYDbahiL7NY...6qCMVJKHAQGzGwg==

カスタム署名キーを追加する

サービス プリンシパルの keyCredentialspasswordCredentials に次の 詳細を追加します。 2 つのオブジェクトに同じプロパティがある場合は、それらのプロパティに同じ値を割り当てる必要があります。

  • customKeyIdentifier は証明書の拇印ハッシュです。
  • startDateTime は、証明書が作成された日時または後の日付です。
  • endDateTime は、startDateTime から最大 3 年にすることができます。 指定しない場合、startDateTime の 1 年後に日付が自動的に割り当てられます。
  • 使用方法は次のとおりです。
    • AsymmetricX509CertVerify をそれぞれ同じオブジェクトに格納します。
    • X509CertAndPasswordSign をそれぞれ同じオブジェクトに格納します。
  • 証明書のサブジェクト名を displayName プロパティに割り当てます。
  • キーは、前の手順で生成した Base64 でエンコードされた値です。
  • keyId は、定義できる GUID です。

要求は、204 No Content 応答コードを返します。

PATCH https://graph.microsoft.com/v1.0/servicePrincipals/ef04fead-8549-4e59-b5f7-d1d8c697ec64
Content-type: application/json

{
    "keyCredentials": [
        {
            "customKeyIdentifier": "5214D6BA9438F984A0CC2C856CCEA6A76EDCEC3A",
            "endDateTime": "2027-01-22T00:00:00Z",
            "keyId": "4c266507-3e74-4b91-aeba-18a25b450f6e",
            "startDateTime": "2024-02-21T17:09:35Z",
            "type": "X509CertAndPassword",
            "usage": "Sign",
            "key": "MIICqjCCAZKgAwIBAgIIZYCy..KlDixjUT61i4tFs=",
            "displayName": "CN=AWSContoso"
        },
        {
            "customKeyIdentifier": "5214D6BA9438F984A0CC2C856CCEA6A76EDCEC3A",
            "endDateTime": "2027-01-22T00:00:00Z",
            "keyId": "e35a7d11-fef0-49ad-9f3e-aacbe0a42c42",
            "startDateTime": "2024-02-21T17:09:35Z",
            "type": "AsymmetricX509Cert",
            "usage": "Verify",
            "key": "MIICqjCCAZKgAwIBAgIIZYCy..KlDixjUT61i4tFs=",
            "displayName": "CN=AWSContoso"
        }
    ],
    "passwordCredentials": [
        {
            "customKeyIdentifier": "5214D6BA9438F984A0CC2C856CCEA6A76EDCEC3A",
            "keyId": "4c266507-3e74-4b91-aeba-18a25b450f6e",
            "endDateTime": "2022-01-27T19:40:33Z",
            "startDateTime": "2027-01-22T00:00:00Z",
            "secretText": "61891f4ee44d"
        }
    ]
}

カスタム署名キーを有効にする

サービス プリンシパルの preferredTokenSigningKeyThumbprint プロパティを、SAML 応答の署名に使用する証明書の拇印Microsoft Entra ID設定する必要があります。 要求は、204 No Content 応答コードを返します。

要求

PATCH https://graph.microsoft.com/v1.0/servicePrincipals/d3616293-fff8-4415-9f01-33b05dad1b46
Content-type: application/json

{
    "preferredTokenSigningKeyThumbprint": "5214D6BA9438F984A0CC2C856CCEA6A76EDCEC3A"
}

手順 7: アプリケーションにユーザーを割り当てる

ユーザーをアプリケーションに割り当てる

作成したユーザーをサービス プリンシパルに割り当て、アプリ ロールを Admin,WAAD 付与します。 要求本文で、次の値を指定します。

  • principalId - 作成したユーザー アカウントの ID。
  • appRoleId - 追加したアプリ ロールの Admin,WAAD ID。
  • resourceId - サービス プリンシパルの ID。

要求

POST https://graph.microsoft.com/v1.0/servicePrincipals/d3616293-fff8-4415-9f01-33b05dad1b46/appRoleAssignments
Content-type: application/json

{
    "principalId": "59bb3898-0621-4414-ac61-74f9d7201355",
    "principalType": "User",
    "appRoleId": "3a84e31e-bffa-470f-b9e6-754a61e4dc63",
    "resourceId": "d3616293-fff8-4415-9f01-33b05dad1b46"
}

応答

HTTP/1.1 201 Created
Content-type: application/json

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#servicePrincipals('d3616293-fff8-4415-9f01-33b05dad1b46')/appRoleAssignments/$entity",
    "id": "mDi7WSEGFESsYXT51yATVdouI-92Rw1OgPSpSxEvaLg",
    "deletedDateTime": null,
    "appRoleId": "3a84e31e-bffa-470f-b9e6-754a61e4dc63",
    "createdDateTime": "2024-02-21T18:07:54.7959075Z",
    "principalDisplayName": "Adele Vance",
    "principalId": "59bb3898-0621-4414-ac61-74f9d7201355",
    "principalType": "User",
    "resourceDisplayName": "AWS Contoso",
    "resourceId": "d3616293-fff8-4415-9f01-33b05dad1b46"
}

手順 8: AWS Contoso アプリMicrosoft Entra ID SAML メタデータを取得する

AWS Contoso アプリのMicrosoft Entra ID SAML メタデータを取得するには、次の URL を使用します。 をテナント ID に置き換え、{appId}AWS Contoso アプリの appId に置き換えます{tenant-id}。 メタデータには、署名証明書、Microsoft Entra entityID、SingleSignOnService Microsoft Entraなどの情報が含まれています。

https://login.microsoftonline.com/{tenant-id}/federationmetadata/2007-06/federationmetadata.xml?appid={appId}

アプリケーションに表示される可能性がある内容の例を次に示します。 データを XML 形式で保存します。

<EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" ID="_26313693-22d4-4361-8e48-ea19bb8616e1" entityID="https://sts.windows.net/38d49456-54d4-455d-a8d6-c383c71e0a6d/">
<RoleDescriptor xmlns:fed="http://docs.oasis-open.org/wsfed/federation/200706" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="fed:SecurityTokenServiceType" protocolSupportEnumeration="http://docs.oasis-open.org/wsfed/federation/200706">
<fed:ClaimTypesOffered>
...
<IDPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
<SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="https://login.microsoftonline.com/38d49456-54d4-455d-a8d6-c383c71e0a6d/saml2"/>
<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="https://login.microsoftonline.com/38d49456-54d4-455d-a8d6-c383c71e0a6d/saml2"/>
<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://login.microsoftonline.com/38d49456-54d4-455d-a8d6-c383c71e0a6d/saml2"/>
</IDPSSODescriptor>
</EntityDescriptor>

手順 9: 統合を完了してテストする

Microsoft Entra IDでアプリケーションの構成手順を完了し、SAML メタデータを取得したら、管理者として AWS IAM Identity Center 企業サイトにサインインし、次の手順を実行します。

  1. AWS IAM Identity Center SSO を構成する手順を完了します。
  2. ユーザー名とメール アドレスが、Microsoft Entra IDで作成したユーザー アカウントと一致するテスト ユーザーを作成します。
  3. SSO 統合をテストします

手順 10: リソースをクリーンアップする

この手順では、作成したリソースを削除し、不要になったリソースを削除します。

アプリケーションを削除する

アプリケーションを削除すると、テナント内のサービス プリンシパルも削除されます。 要求は、204 No Content 応答コードを返します。

DELETE https://graph.microsoft.com/v1.0/applications/b7308000-8bb3-467b-bfc7-8dbbfd759ad9

テスト ユーザー アカウントを削除する

要求は、204 No Content 応答コードを返します。

DELETE https://graph.microsoft.com/v1.0/users/59bb3898-0621-4414-ac61-74f9d7201355

要求マッピング ポリシーを削除する

要求は、204 No Content 応答コードを返します。

DELETE https://graph.microsoft.com/v1.0/policies/claimsMappingPolicies/a4b35718-fd5e-4ca8-8248-a3c9934b1b78