다음을 통해 공유


PowerShell 또는 Microsoft Graph API를 사용하여 테넌트 간 동기화 구성

이 문서에서는 Microsoft Graph PowerShell 또는 Microsoft Graph API를 사용하여 테넌트 간 동기화를 구성하는 주요 단계를 설명합니다. 구성되면 Microsoft Entra ID는 대상 테넌트에서 B2B 사용자를 자동으로 프로비전 및 프로비전 해제합니다. Microsoft Entra 관리 센터를 사용하는 자세한 단계는 테넌트 간 동기화 구성을 참조하세요.

원본 테넌트 및 대상 테넌트 간 동기화를 보여 주는 다이어그램

필수 조건

원본 테넌트에 대한 아이콘.
원본 테넌트

대상 테넌트 아이콘.
대상 테넌트

1단계: 대상 테넌트에 로그인

대상 테넌트 아이콘.
대상 테넌트

  1. PowerShell을 시작합니다.

  2. 필요한 경우 Microsoft Graph PowerShell SDK를 설치합니다.

  3. 원본 및 대상 테넌트의 테넌트 ID를 가져오고 변수를 초기화합니다.

    $SourceTenantId = "<SourceTenantId>"
    $TargetTenantId = "<TargetTenantId>"
    
  4. Connect-MgGraph 명령을 사용하여 대상 테넌트에 로그인하고 다음 필수 권한에 동의합니다.

    • Policy.Read.All
    • Policy.ReadWrite.CrossTenantAccess
    Connect-MgGraph -TenantId $TargetTenantId -Scopes "Policy.Read.All","Policy.ReadWrite.CrossTenantAccess"
    

2단계: 대상 테넌트에서 사용자 동기화 사용

대상 테넌트 아이콘.
대상 테넌트

  1. 대상 테넌트에서 New-MgPolicyCrossTenantAccessPolicyPartner 명령을 사용하여 대상 테넌트와 원본 테넌트 간의 테넌트 간 액세스 정책에서 새 파트너 구성을 만듭니다. 요청에서 원본 테넌트 ID를 사용합니다.

    오류 New-MgPolicyCrossTenantAccessPolicyPartner_Create: Another object with the same value for property tenantId already exists가 발생하면 기존 구성이 이미 있을 수 있습니다. 자세한 내용은 증상 - New-MgPolicyCrossTenantAccessPolicyPartner_Create 오류를 참조하세요.

    $Params = @{
        TenantId = $SourceTenantId
    }
    New-MgPolicyCrossTenantAccessPolicyPartner -BodyParameter $Params | Format-List
    
    AutomaticUserConsentSettings : Microsoft.Graph.PowerShell.Models.MicrosoftGraphInboundOutboundPolicyConfiguration
    B2BCollaborationInbound      : Microsoft.Graph.PowerShell.Models.MicrosoftGraphCrossTenantAccessPolicyB2BSetting
    B2BCollaborationOutbound     : Microsoft.Graph.PowerShell.Models.MicrosoftGraphCrossTenantAccessPolicyB2BSetting
    B2BDirectConnectInbound      : Microsoft.Graph.PowerShell.Models.MicrosoftGraphCrossTenantAccessPolicyB2BSetting
    B2BDirectConnectOutbound     : Microsoft.Graph.PowerShell.Models.MicrosoftGraphCrossTenantAccessPolicyB2BSetting
    IdentitySynchronization      : Microsoft.Graph.PowerShell.Models.MicrosoftGraphCrossTenantIdentitySyncPolicyPartner
    InboundTrust                 : Microsoft.Graph.PowerShell.Models.MicrosoftGraphCrossTenantAccessPolicyInboundTrust
    IsServiceProvider            :
    TenantId                     : <SourceTenantId>
    TenantRestrictions           : Microsoft.Graph.PowerShell.Models.MicrosoftGraphCrossTenantAccessPolicyTenantRestrictions
    AdditionalProperties         : {[@odata.context, https://graph.microsoft.com/v1.0/$metadata#policies/crossTenantAccessPolicy/partners/$entity],
                                   [crossCloudMeetingConfiguration,
                                   System.Collections.Generic.Dictionary`2[System.String,System.Object]], [protectedContentSharing,
                                   System.Collections.Generic.Dictionary`2[System.String,System.Object]]}
    
  2. Invoke-MgGraphRequest 명령을 사용하여 대상 테넌트에서 사용자 동기화를 사용하도록 설정합니다.

    오류 Request_MultipleObjectsWithSameKeyValue가 발생하면 기존 정책이 이미 있을 수 있습니다. 자세한 내용은 증상 - Request_MultipleObjectsWithSameKeyValue 오류를 참조하세요.

    $Params = @{
        userSyncInbound = @{
            isSyncAllowed = $true
        }
    }
    Invoke-MgGraphRequest -Method PUT -Uri "https://graph.microsoft.com/v1.0/policies/crossTenantAccessPolicy/partners/$SourceTenantId/identitySynchronization" -Body $Params
    
  3. Get-MgPolicyCrossTenantAccessPolicyPartnerIdentitySynchronization 명령을 사용하여 IsSyncAllowed가 True로 설정되어 있는지 확인합니다.

    (Get-MgPolicyCrossTenantAccessPolicyPartnerIdentitySynchronization -CrossTenantAccessPolicyConfigurationPartnerTenantId $SourceTenantId).UserSyncInbound
    
    IsSyncAllowed
    -------------
    True
    

3단계: 대상 테넌트에서 초대 자동 사용

대상 테넌트 아이콘.
대상 테넌트

  1. 대상 테넌트에서 Update-MgPolicyCrossTenantAccessPolicyPartner 명령을 사용하여 초대를 자동으로 사용하고 인바운드 액세스에 대한 동의 프롬프트가 표시되지 않도록 합니다.

    $AutomaticUserConsentSettings = @{
        "InboundAllowed"="True"
    }
    Update-MgPolicyCrossTenantAccessPolicyPartner -CrossTenantAccessPolicyConfigurationPartnerTenantId $SourceTenantId -AutomaticUserConsentSettings $AutomaticUserConsentSettings
    

4단계: 원본 테넌트 로그인

원본 테넌트에 대한 아이콘.
원본 테넌트

  1. PowerShell 인스턴스를 시작합니다.

  2. 원본 및 대상 테넌트의 테넌트 ID를 가져오고 변수를 초기화합니다.

    $SourceTenantId = "<SourceTenantId>"
    $TargetTenantId = "<TargetTenantId>"
    
  3. Connect-MgGraph 명령을 사용하여 원본 테넌트에 로그인하고 다음 필수 권한에 동의합니다.

    • Policy.Read.All
    • Policy.ReadWrite.CrossTenantAccess
    • Application.ReadWrite.All
    • Directory.ReadWrite.All
    • AuditLog.Read.All
    Connect-MgGraph -TenantId $SourceTenantId -Scopes "Policy.Read.All","Policy.ReadWrite.CrossTenantAccess","Application.ReadWrite.All","Directory.ReadWrite.All","AuditLog.Read.All"
    

5단계: 원본 테넌트에서 초대 자동 사용

원본 테넌트에 대한 아이콘.
원본 테넌트

  1. 원본 테넌트에서 New-MgPolicyCrossTenantAccessPolicyPartner 명령을 사용하여 원본 테넌트와 대상 테넌트 간의 테넌트 간 액세스 정책에서 새 파트너 구성을 만듭니다. 요청에서 대상 테넌트 ID를 사용합니다.

    오류 New-MgPolicyCrossTenantAccessPolicyPartner_Create: Another object with the same value for property tenantId already exists가 발생하면 기존 구성이 이미 있을 수 있습니다. 자세한 내용은 증상 - New-MgPolicyCrossTenantAccessPolicyPartner_Create 오류를 참조하세요.

    $Params = @{
        TenantId = $TargetTenantId
    }
    New-MgPolicyCrossTenantAccessPolicyPartner -BodyParameter $Params | Format-List
    
    AutomaticUserConsentSettings : Microsoft.Graph.PowerShell.Models.MicrosoftGraphInboundOutboundPolicyConfiguration
    B2BCollaborationInbound      : Microsoft.Graph.PowerShell.Models.MicrosoftGraphCrossTenantAccessPolicyB2BSetting
    B2BCollaborationOutbound     : Microsoft.Graph.PowerShell.Models.MicrosoftGraphCrossTenantAccessPolicyB2BSetting
    B2BDirectConnectInbound      : Microsoft.Graph.PowerShell.Models.MicrosoftGraphCrossTenantAccessPolicyB2BSetting
    B2BDirectConnectOutbound     : Microsoft.Graph.PowerShell.Models.MicrosoftGraphCrossTenantAccessPolicyB2BSetting
    IdentitySynchronization      : Microsoft.Graph.PowerShell.Models.MicrosoftGraphCrossTenantIdentitySyncPolicyPartner
    InboundTrust                 : Microsoft.Graph.PowerShell.Models.MicrosoftGraphCrossTenantAccessPolicyInboundTrust
    IsServiceProvider            :
    TenantId                     : <TargetTenantId>
    TenantRestrictions           : Microsoft.Graph.PowerShell.Models.MicrosoftGraphCrossTenantAccessPolicyTenantRestrictions
    AdditionalProperties         : {[@odata.context, https://graph.microsoft.com/v1.0/$metadata#policies/crossTenantAccessPolicy/partners/$entity],
                                   [crossCloudMeetingConfiguration,
                                   System.Collections.Generic.Dictionary`2[System.String,System.Object]], [protectedContentSharing,
                                   System.Collections.Generic.Dictionary`2[System.String,System.Object]]}
    
    
  2. Update-MgPolicyCrossTenantAccessPolicyPartner 명령을 사용하여 초대를 자동으로 사용하고 아웃바운드 액세스에 대한 동의 프롬프트가 표시되지 않도록 합니다.

    $AutomaticUserConsentSettings = @{
        "OutboundAllowed"="True"
    }
    Update-MgPolicyCrossTenantAccessPolicyPartner -CrossTenantAccessPolicyConfigurationPartnerTenantId $TargetTenantId -AutomaticUserConsentSettings $AutomaticUserConsentSettings
    

6단계: 원본 테넌트에서 구성 애플리케이션 만들기

원본 테넌트에 대한 아이콘.
원본 테넌트

  1. 원본 테넌트에서 Invoke-MgInstantiateApplicationTemplate 명령을 사용하여 Microsoft Entra 애플리케이션 갤러리의 구성 애플리케이션 인스턴스를 테넌트에 추가합니다.

    Invoke-MgInstantiateApplicationTemplate -ApplicationTemplateId "518e5f48-1fc8-4c48-9387-9fdf28b0dfe7" -DisplayName "Fabrikam"
    
  2. Get-MgServicePrincipal 명령을 사용하여 서비스 주체 ID 및 앱 역할 ID를 가져옵니다.

    Get-MgServicePrincipal -Filter "DisplayName eq 'Fabrikam'" | Format-List
    
    AccountEnabled                      : True
    AddIns                              : {}
    AlternativeNames                    : {}
    AppDescription                      :
    AppDisplayName                      : Fabrikam
    AppId                               : <AppId>
    AppManagementPolicies               :
    AppOwnerOrganizationId              : <AppOwnerOrganizationId>
    AppRoleAssignedTo                   :
    AppRoleAssignmentRequired           : True
    AppRoleAssignments                  :
    AppRoles                            : {<AppRoleId>}
    ApplicationTemplateId               : 518e5f48-1fc8-4c48-9387-9fdf28b0dfe7
    ClaimsMappingPolicies               :
    CreatedObjects                      :
    CustomSecurityAttributes            : Microsoft.Graph.PowerShell.Models.MicrosoftGraphCustomSecurityAttributeValue
    DelegatedPermissionClassifications  :
    DeletedDateTime                     :
    Description                         :
    DisabledByMicrosoftStatus           :
    DisplayName                         : Fabrikam
    Endpoints                           :
    ErrorUrl                            :
    FederatedIdentityCredentials        :
    HomeRealmDiscoveryPolicies          :
    Homepage                            : https://account.activedirectory.windowsazure.com:444/applications/default.aspx?metadata=aad2aadsync|ISV9.1|primary|z
    Id                                  : <ServicePrincipalId>
    Info                                : Microsoft.Graph.PowerShell.Models.MicrosoftGraphInformationalUrl
    KeyCredentials                      : {}
    LicenseDetails                      :
    
    ...
    
  3. 서비스 주체 ID에 대한 변수를 초기화합니다.

    애플리케이션 ID 대신 서비스 주체 ID를 사용해야 합니다.

    $ServicePrincipalId = "<ServicePrincipalId>"
    
  4. 앱 역할 ID에 대한 변수를 초기화합니다.

    $AppRoleId= "<AppRoleId>"
    

7단계: 대상 테넌트에 대한 연결 테스트

원본 테넌트에 대한 아이콘.
원본 테넌트

  1. 원본 테넌트에서 Invoke-MgGraphRequest 명령을 사용하여 대상 테넌트에 대한 연결을 테스트하고 자격 증명이 유효한지 검사합니다.

    $Params = @{
        "useSavedCredentials" = $false
        "templateId" = "Azure2Azure"
        "credentials" = @(
            @{
                "key" = "CompanyId"
                "value" = $TargetTenantId
            }
            @{
                "key" = "AuthenticationType"
                "value" = "SyncPolicy"
            }
        )
    }
    Invoke-MgGraphRequest -Method POST -Uri "https://graph.microsoft.com/v1.0/servicePrincipals/$ServicePrincipalId/synchronization/jobs/validateCredentials" -Body $Params
    

8단계: 원본 테넌트에서 프로비전 작업 만들기

원본 테넌트에 대한 아이콘.
원본 테넌트

원본 테넌트에서 프로비전을 사용하도록 설정하려면 프로비전 작업을 만듭니다.

  1. 사용할 동기화 템플릿(예: Azure2Azure)을 결정합니다.

    템플릿에는 미리 구성된 동기화 설정이 있습니다.

  2. 원본 테넌트에서 New-MgServicePrincipalSynchronizationJob 명령을 사용하여 템플릿을 기준으로 프로비전 작업을 만듭니다.

    New-MgServicePrincipalSynchronizationJob -ServicePrincipalId $ServicePrincipalId -TemplateId "Azure2Azure" | Format-List
    
    Id                         : <JobId>
    Schedule                   : Microsoft.Graph.PowerShell.Models.MicrosoftGraphSynchronizationSchedule
    Schema                     : Microsoft.Graph.PowerShell.Models.MicrosoftGraphSynchronizationSchema
    Status                     : Microsoft.Graph.PowerShell.Models.MicrosoftGraphSynchronizationStatus
    SynchronizationJobSettings : {AzureIngestionAttributeOptimization, LookaheadQueryEnabled}
    TemplateId                 : Azure2Azure
    AdditionalProperties       : {[@odata.context, https://graph.microsoft.com/v1.0/$metadata#servicePrincipals('<ServicePrincipalId>')/synchro
                                 nization/jobs/$entity]}
    
  3. 작업 ID에 대한 변수를 초기화합니다.

    $JobId = "<JobId>"
    

9단계: 자격 증명 저장

원본 테넌트에 대한 아이콘.
원본 테넌트

  1. 원본 테넌트에서 Invoke-MgGraphRequest 명령을 사용하여 자격 증명을 저장합니다.

    $Params = @{
        "value" = @(
            @{
                "key" = "AuthenticationType"
                "value" = "SyncPolicy"
            }
            @{
                "key" = "CompanyId"
                "value" = $TargetTenantId
            }
        )
    }
    Invoke-MgGraphRequest -Method PUT -Uri "https://graph.microsoft.com/v1.0/servicePrincipals/$ServicePrincipalId/synchronization/secrets" -Body $Params
    

10단계: 구성에 사용자 할당

원본 테넌트에 대한 아이콘.
원본 테넌트

테넌트 간 동기화가 작동하려면 구성에 하나 이상의 내부 사용자를 할당해야 합니다.

  1. 원본 테넌트에서 New-MgServicePrincipalAppRoleAssignedTo를 사용하여 내부 사용자를 구성에 할당합니다.

    $Params = @{
        PrincipalId = "<PrincipalId>"
        ResourceId = $ServicePrincipalId
        AppRoleId = $AppRoleId
    }
    New-MgServicePrincipalAppRoleAssignedTo -ServicePrincipalId $ServicePrincipalId -BodyParameter $Params | Format-List
    
    AppRoleId            : <AppRoleId>
    CreatedDateTime      : 7/31/2023 10:27:12 PM
    DeletedDateTime      :
    Id                   : <Id>
    PrincipalDisplayName : User1
    PrincipalId          : <PrincipalId>
    PrincipalType        : User
    ResourceDisplayName  : Fabrikam
    ResourceId           : <ServicePrincipalId>
    AdditionalProperties : {[@odata.context, https://graph.microsoft.com/v1.0/$metadata#appRoleAssignments/$entity]}
    

11단계: 요청 시 프로비전 테스트

원본 테넌트에 대한 아이콘.
원본 테넌트

이제 구성이 있으므로 사용자 중 한 명으로 요청 시 프로비전을 테스트할 수 있습니다.

  1. 원본 테넌트에서 Get-MgServicePrincipalSynchronizationJobSchema 명령을 사용하여 스키마 규칙 ID를 가져옵니다.

    $SynchronizationSchema = Get-MgServicePrincipalSynchronizationJobSchema -ServicePrincipalId $ServicePrincipalId -SynchronizationJobId $JobId
    $SynchronizationSchema.SynchronizationRules | Format-List
    
    ContainerFilter      : Microsoft.Graph.PowerShell.Models.MicrosoftGraphContainerFilter
    Editable             : True
    GroupFilter          : Microsoft.Graph.PowerShell.Models.MicrosoftGraphGroupFilter
    Id                   : <RuleId>
    Metadata             : {defaultSourceObjectMappings, supportsProvisionOnDemand}
    Name                 : USER_INBOUND_USER
    ObjectMappings       : {Provision Azure Active Directory Users, , , …}
    Priority             : 1
    SourceDirectoryName  : Azure Active Directory
    TargetDirectoryName  : Azure Active Directory (target tenant)
    AdditionalProperties : {}
    
  2. 규칙 ID에 대한 변수를 초기화합니다.

    $RuleId = "<RuleId>"
    
  3. New-MgServicePrincipalSynchronizationJobOnDemand 명령을 사용하여 요청 시 테스트 사용자를 프로비전합니다.

    $Params = @{
        Parameters = @(
            @{
                Subjects = @(
                    @{
                        ObjectId = "<UserObjectId>"
                        ObjectTypeName = "User"
                    }
                )
                RuleId = $RuleId
            }
        )
    }
    New-MgServicePrincipalSynchronizationJobOnDemand -ServicePrincipalId $ServicePrincipalId -SynchronizationJobId $JobId -BodyParameter $Params | Format-List
    
    Key                  : Microsoft.Identity.Health.CPP.Common.DataContracts.SyncFabric.StatusInfo
    Value                : [{"provisioningSteps":[{"name":"EntryImport","type":"Import","status":"Success","description":"Retrieved User
                           'user1@fabrikam.com' from Azure Active Directory","timestamp":"2023-07-31T22:31:15.9116590Z","details":{"objectId":
                           "<UserObjectId>","accountEnabled":"True","displayName":"User1","mailNickname":"user1","userPrincipalName":"use
                           ...
    AdditionalProperties : {[@odata.context, https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.stringKeyStringValuePair]}
    

12단계: 프로비전 작업 시작

원본 테넌트에 대한 아이콘.
원본 테넌트

  1. 이제 프로비전 작업이 구성되었으므로 원본 테넌트에서 Start-MgServicePrincipalSynchronizationJob 명령을 사용하여 프로비전 작업을 시작합니다.

    Start-MgServicePrincipalSynchronizationJob -ServicePrincipalId $ServicePrincipalId -SynchronizationJobId $JobId
    

13단계: 프로비전 모니터링

원본 테넌트에 대한 아이콘.
원본 테넌트

  1. 프로비전 작업이 실행되고 있으므로 원본 테넌트에서 Get-MgServicePrincipalSynchronizationJob 명령을 사용하여 대상 시스템에 생성된 사용자 및 그룹의 수와 같은 통계 뿐만 아니라 현재 프로비전 주기의 진행 상황을 모니터링합니다.

    Get-MgServicePrincipalSynchronizationJob -ServicePrincipalId $ServicePrincipalId -SynchronizationJobId $JobId | Format-List
    
    Id                         : <JobId>
    Schedule                   : Microsoft.Graph.PowerShell.Models.MicrosoftGraphSynchronizationSchedule
    Schema                     : Microsoft.Graph.PowerShell.Models.MicrosoftGraphSynchronizationSchema
    Status                     : Microsoft.Graph.PowerShell.Models.MicrosoftGraphSynchronizationStatus
    SynchronizationJobSettings : {AzureIngestionAttributeOptimization, LookaheadQueryEnabled}
    TemplateId                 : Azure2Azure
    AdditionalProperties       : {[@odata.context, https://graph.microsoft.com/v1.0/$metadata#servicePrincipals('<ServicePrincipalId>')/synchro
                                 nization/jobs/$entity]}
    
  2. 프로비전 작업의 상태를 모니터링하는 것 외에도 Get-MgAuditLogProvisioning 명령을 사용하여 프로비전 로그를 검색하고 발생하는 모든 프로비전 이벤트를 가져옵니다. 예를 들어, 특정 사용자를 쿼리하고 성공적으로 프로비저닝되었는지 확인합니다.

    Get-MgAuditLogDirectoryAudit | Select -First 10 | Format-List
    
    ActivityDateTime     : 7/31/2023 12:08:17 AM
    ActivityDisplayName  : Export
    AdditionalDetails    : {Details, ErrorCode, EventName, ipaddr...}
    Category             : ProvisioningManagement
    CorrelationId        : aaaa0000-bb11-2222-33cc-444444dddddd
    Id                   : Sync_aaaa0000-bb11-2222-33cc-444444dddddd_L5BFV_161778479
    InitiatedBy          : Microsoft.Graph.PowerShell.Models.MicrosoftGraphAuditActivityInitiator1
    LoggedByService      : Account Provisioning
    OperationType        :
    Result               : success
    ResultReason         : User 'user2@fabrikam.com' was created in Azure Active Directory (target tenant)
    TargetResources      : {<ServicePrincipalId>, }
    AdditionalProperties : {}
    
    ActivityDateTime     : 7/31/2023 12:08:17 AM
    ActivityDisplayName  : Export
    AdditionalDetails    : {Details, ErrorCode, EventName, ipaddr...}
    Category             : ProvisioningManagement
    CorrelationId        : aaaa0000-bb11-2222-33cc-444444dddddd
    Id                   : Sync_aaaa0000-bb11-2222-33cc-444444dddddd_L5BFV_161778264
    InitiatedBy          : Microsoft.Graph.PowerShell.Models.MicrosoftGraphAuditActivityInitiator1
    LoggedByService      : Account Provisioning
    OperationType        :
    Result               : success
    ResultReason         : User 'user2@fabrikam.com' was updated in Azure Active Directory (target tenant)
    TargetResources      : {<ServicePrincipalId>, }
    AdditionalProperties : {}
    
    ActivityDateTime     : 7/31/2023 12:08:14 AM
    ActivityDisplayName  : Synchronization rule action
    AdditionalDetails    : {Details, ErrorCode, EventName, ipaddr...}
    Category             : ProvisioningManagement
    CorrelationId        : aaaa0000-bb11-2222-33cc-444444dddddd
    Id                   : Sync_aaaa0000-bb11-2222-33cc-444444dddddd_L5BFV_161778395
    InitiatedBy          : Microsoft.Graph.PowerShell.Models.MicrosoftGraphAuditActivityInitiator1
    LoggedByService      : Account Provisioning
    OperationType        :
    Result               : success
    ResultReason         : User 'user2@fabrikam.com' will be created in Azure Active Directory (target tenant) (User is active and assigned
                           in Azure Active Directory, but no matching User was found in Azure Active Directory (target tenant))
    TargetResources      : {<ServicePrincipalId>, }
    AdditionalProperties : {}
    

문제 해결 팁

증상 - 권한 부족 오류

작업을 수행하려고 하면 다음과 유사한 오류 메시지가 표시됩니다.

code: Authorization_RequestDenied
message: Insufficient privileges to complete the operation.

원인

로그인한 사용자에게 충분한 권한이 없거나 필요한 권한 중 하나에 동의해야 합니다.

솔루션

  1. 필요한 역할이 할당되었는지 확인합니다. 이 문서 앞부분에 나오는 필수 구성 요소를 참조하세요.

  2. Connect-MgGraph로 로그인할 때 필요한 범위를 지정해야 합니다. 이 문서의 앞부분에서 1단계: 대상 테넌트에 로그인4단계: 원본 테넌트에 로그인을 참조하세요.

증상 - New-MgPolicyCrossTenantAccessPolicyPartner_Create 오류

새 파트너 구성을 만들려고 하면 다음과 유사한 오류 메시지가 표시됩니다.

New-MgPolicyCrossTenantAccessPolicyPartner_Create: Another object with the same value for property tenantId already exists.

원인

이전 구성에서 이미 존재하는 구성 또는 개체를 만들려고 할 수 있습니다.

솔루션

  1. 구문을 확인하고 올바른 테넌트 ID를 사용하고 있는지 확인합니다.

  2. Get-MgPolicyCrossTenantAccessPolicyPartner 명령을 사용하여 기존 개체를 나열합니다.

  3. 기존 개체가 있는 경우 Update-MgPolicyCrossTenantAccessPolicyPartner를 사용하여 업데이트해야 할 수 있습니다.

증상 - Request_MultipleObjectsWithSameKeyValue 오류

사용자 동기화를 사용하도록 설정하려고 하면 다음과 유사한 오류 메시지가 표시됩니다.

Invoke-MgGraphRequest: PUT https://graph.microsoft.com/v1.0/policies/crossTenantAccessPolicy/partners/<SourceTenantId>/identitySynchronization
HTTP/1.1 409 Conflict
...
{"error":{"code":"Request_MultipleObjectsWithSameKeyValue","message":"A conflicting object with one or more of the specified property values is present in the directory.","details":[{"code":"ConflictingObjects","message":"A conflicting object with one or more of the specified property values is present in the directory.", ... }}}

원인

이전 구성에서 이미 존재하는 정책을 만들려고 할 수 있습니다.

솔루션

  1. 구문을 확인하고 올바른 테넌트 ID를 사용하고 있는지 확인합니다.

  2. Get-MgPolicyCrossTenantAccessPolicyPartnerIdentitySynchronization 명령을 사용하여 IsSyncAllowed 설정을 나열합니다.

    (Get-MgPolicyCrossTenantAccessPolicyPartnerIdentitySynchronization -CrossTenantAccessPolicyConfigurationPartnerTenantId $SourceTenantId).UserSyncInbound
    
  3. 기존 정책이 있는 경우 Set-MgPolicyCrossTenantAccessPolicyPartnerIdentitySynchronization 명령을 사용하여 업데이트하여 사용자 동기화를 사용하도록 설정해야 할 수 있습니다.

    $Params = @{
        userSyncInbound = @{
            isSyncAllowed = $true
        }
    }
    Set-MgPolicyCrossTenantAccessPolicyPartnerIdentitySynchronization -CrossTenantAccessPolicyConfigurationPartnerTenantId $SourceTenantId -BodyParameter $Params
    

다음 단계