Delen via


Synchronisatie tussen tenants configureren met Behulp van PowerShell of Microsoft Graph API

In dit artikel worden de belangrijkste stappen beschreven voor het configureren van synchronisatie tussen tenants met behulp van Microsoft Graph PowerShell of Microsoft Graph API. Wanneer deze is geconfigureerd, wordt B2B-gebruikers in uw doeltenant automatisch ingericht en ongedaan maken van de inrichting van B2B-gebruikers door Microsoft Entra ID. Zie Synchronisatie tussen tenants configureren voor gedetailleerde stappen met behulp van het Microsoft Entra-beheercentrum.

Diagram met synchronisatie tussen meerdere tenants tussen de brontenant en de doeltenant.

Vereisten

Pictogram voor de brontenant.
Brontenant

Pictogram voor de doeltenant.
Doeltenant

Stap 1: Aanmelden bij de doeltenant

Pictogram voor de doeltenant.
Doeltenant

  1. Start PowerShell.

  2. Installeer zo nodig de Microsoft Graph PowerShell SDK.

  3. Haal de tenant-id van de bron- en doeltenants op en initialiseer variabelen.

    $SourceTenantId = "<SourceTenantId>"
    $TargetTenantId = "<TargetTenantId>"
    
  4. Gebruik de opdracht Verbinding maken-MgGraph om u aan te melden bij de doeltenant en toestemming te geven voor de volgende vereiste machtigingen.

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

Stap 2: Gebruikerssynchronisatie inschakelen in de doeltenant

Pictogram voor de doeltenant.
Doeltenant

  1. Gebruik in de doeltenant de opdracht New-MgPolicyCrossTenantAccessPolicyPartner om een nieuwe partnerconfiguratie te maken in een beleid voor toegang tussen meerdere tenants tussen de doeltenant en de brontenant. Gebruik de brontenant-id in de aanvraag.

    Als u de fout New-MgPolicyCrossTenantAccessPolicyPartner_Create: Another object with the same value for property tenantId already existskrijgt, hebt u mogelijk al een bestaande configuratie. Zie Symptom - New-MgPolicyCrossTenantAccessPolicyPartner_Create error voor meer informatie.

    $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. Gebruik de opdracht Invoke-MgGraphRequest om gebruikerssynchronisatie in te schakelen in de doeltenant.

    Als er een Request_MultipleObjectsWithSameKeyValue fout optreedt, hebt u mogelijk al een bestaand beleid. Zie Symptoom - Request_MultipleObjectsWithSameKeyValue fout voor meer informatie.

    $Params = @{
        userSyncInbound = @{
            isSyncAllowed = $true
        }
    }
    Invoke-MgGraphRequest -Method PUT -Uri "https://graph.microsoft.com/v1.0/policies/crossTenantAccessPolicy/partners/$SourceTenantId/identitySynchronization" -Body $Params
    
  3. Gebruik de opdracht Get-MgPolicyCrossTenantAccessPolicyPartnerIdentitySynchronization om te controleren of IsSyncAllowed deze is ingesteld op True.

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

Stap 3: Uitnodigingen automatisch inwisselen in de doeltenant

Pictogram voor de doeltenant.
Doeltenant

  1. Gebruik in de doeltenant de opdracht Update-MgPolicyCrossTenantAccessPolicyPartner om uitnodigingen automatisch in te wisselen en toestemmingsprompts voor binnenkomende toegang te onderdrukken.

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

Stap 4: Aanmelden bij de brontenant

Pictogram voor de brontenant.
Brontenant

  1. Start een exemplaar van PowerShell.

  2. Haal de tenant-id van de bron- en doeltenants op en initialiseer variabelen.

    $SourceTenantId = "<SourceTenantId>"
    $TargetTenantId = "<TargetTenantId>"
    
  3. Gebruik de opdracht Verbinding maken-MgGraph om u aan te melden bij de brontenant en toestemming te geven voor de volgende vereiste machtigingen.

    • 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"
    

Stap 5: Uitnodigingen automatisch inwisselen in de brontenant

Pictogram voor de brontenant.
Brontenant

  1. Gebruik in de brontenant de opdracht New-MgPolicyCrossTenantAccessPolicyPartner om een nieuwe partnerconfiguratie te maken in een beleid voor meerdere tenants tussen de brontenant en de doeltenant. Gebruik de tenant-id van het doel in de aanvraag.

    Als u de fout New-MgPolicyCrossTenantAccessPolicyPartner_Create: Another object with the same value for property tenantId already existskrijgt, hebt u mogelijk al een bestaande configuratie. Zie Symptom - New-MgPolicyCrossTenantAccessPolicyPartner_Create error voor meer informatie.

    $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. Gebruik de opdracht Update-MgPolicyCrossTenantAccessPolicyPartner om uitnodigingen automatisch in te wisselen en toestemmingsprompts voor uitgaande toegang te onderdrukken.

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

Stap 6: Een configuratietoepassing maken in de brontenant

Pictogram voor de brontenant.
Brontenant

  1. Gebruik in de brontenant de opdracht Invoke-MgInstantiateApplicationTemplate om een exemplaar van een configuratietoepassing vanuit de Microsoft Entra-toepassingsgalerie toe te voegen aan uw tenant.

    Invoke-MgInstantiateApplicationTemplate -ApplicationTemplateId "518e5f48-1fc8-4c48-9387-9fdf28b0dfe7" -DisplayName "Fabrikam"
    
  2. Gebruik de opdracht Get-MgServicePrincipal om de service-principal-id en de rol-id van de app op te halen.

    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. Initialiseer een variabele voor de service-principal-id.

    Zorg ervoor dat u de service-principal-id gebruikt in plaats van de toepassings-id.

    $ServicePrincipalId = "<ServicePrincipalId>"
    
  4. Initialiseer een variabele voor de app-rol-id.

    $AppRoleId= "<AppRoleId>"
    

Stap 7: De verbinding met de doeltenant testen

Pictogram voor de brontenant.
Brontenant

  1. Gebruik in de brontenant de opdracht Invoke-MgGraphRequest om de verbinding met de doeltenant te testen en de referenties te valideren.

    $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
    

Stap 8: Een inrichtingstaak maken in de brontenant

Pictogram voor de brontenant.
Brontenant

Maak in de brontenant een inrichtingstaak om inrichting in te schakelen.

  1. Bepaal de synchronisatiesjabloon die moet worden gebruikt, zoals Azure2Azure.

    Een sjabloon heeft vooraf geconfigureerde synchronisatie-instellingen.

  2. Gebruik in de brontenant de opdracht New-MgServicePrincipalSynchronizationJob om een inrichtingstaak te maken op basis van een sjabloon.

    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. Initialiseer een variabele voor de taak-id.

    $JobId = "<JobId>"
    

Stap 9: Uw referenties opslaan

Pictogram voor de brontenant.
Brontenant

  1. Gebruik in de brontenant de opdracht Invoke-MgGraphRequest om uw referenties op te slaan.

    $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
    

Stap 10: Een gebruiker toewijzen aan de configuratie

Pictogram voor de brontenant.
Brontenant

Synchronisatie tussen tenants werkt alleen als ten minste één interne gebruiker aan de configuratie is toegewezen.

  1. Gebruik in de brontenant de opdracht New-MgServicePrincipalAppRoleAssignedTo om een interne gebruiker toe te wijzen aan de configuratie.

    $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]}
    

Stap 11: Inrichting op aanvraag testen

Pictogram voor de brontenant.
Brontenant

Nu u een configuratie hebt, kunt u inrichting op aanvraag testen met een van uw gebruikers.

  1. Gebruik in de brontenant de opdracht Get-MgServicePrincipalSynchronizationJobSchema om de schemaregel-id op te halen.

    $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. Initialiseer een variabele voor de regel-id.

    $RuleId = "<RuleId>"
    
  3. Gebruik de opdracht New-MgServicePrincipalSynchronizationJobOnDemand om een testgebruiker op aanvraag in te richten.

    $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]}
    

Stap 12: De inrichtingstaak starten

Pictogram voor de brontenant.
Brontenant

  1. Nu de inrichtingstaak is geconfigureerd, gebruikt u in de brontenant de opdracht Start-MgServicePrincipalSynchronizationJob om de inrichtingstaak te starten.

    Start-MgServicePrincipalSynchronizationJob -ServicePrincipalId $ServicePrincipalId -SynchronizationJobId $JobId
    

Stap 13: Inrichting bewaken

Pictogram voor de brontenant.
Brontenant

  1. Nu de inrichtingstaak wordt uitgevoerd, gebruikt u in de brontenant de opdracht Get-MgServicePrincipalSynchronizationJob om de voortgang van de huidige inrichtingscyclus en statistieken tot op heden te controleren, zoals het aantal gebruikers en groepen dat in het doelsysteem is gemaakt.

    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. Naast het bewaken van de status van de inrichtingstaak, gebruikt u de opdracht Get-MgAuditLogProvisioning om de inrichtingslogboeken op te halen en alle inrichtingsgebeurtenissen op te halen die zich voordoen. Voer bijvoorbeeld een query uit voor een bepaalde gebruiker en bepaal of deze zijn ingericht.

    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 : {}
    

Tips voor probleemoplossing

Symptoom : fout met onvoldoende bevoegdheden

Wanneer u een actie probeert uit te voeren, wordt er een foutbericht weergegeven dat er ongeveer als volgt uitziet:

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

Oorzaak

De aangemelde gebruiker heeft onvoldoende bevoegdheden of u moet toestemming geven voor een van de vereiste machtigingen.

Oplossing

  1. Zorg ervoor dat u de vereiste rollen hebt toegewezen. Zie Vereisten eerder in dit artikel.

  2. Wanneer u zich aanmeldt met Verbinding maken-MgGraph, moet u de vereiste bereiken opgeven. Zie stap 1: Meld u aan bij de doeltenant en stap 4: Meld u eerder in dit artikel aan bij de brontenant .

Symptoom - Fout met nieuwe MgPolicyCrossTenantAccessPolicyPartner_Create

Wanneer u probeert een nieuwe partnerconfiguratie te maken, wordt er een foutbericht weergegeven dat er ongeveer als volgt uitziet:

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

Oorzaak

U probeert waarschijnlijk een configuratie of object te maken dat al bestaat, mogelijk op basis van een eerdere configuratie.

Oplossing

  1. Controleer uw syntaxis en of u de juiste tenant-id gebruikt.

  2. Gebruik de opdracht Get-MgPolicyCrossTenantAccessPolicyPartner om het bestaande object weer te geven.

  3. Als u een bestaand object hebt, moet u mogelijk een update uitvoeren met update-MgPolicyCrossTenantAccessPolicyPartner

Symptoom - Request_MultipleObjectsWithSameKeyValue fout

Wanneer u gebruikerssynchronisatie probeert in te schakelen, wordt er een foutbericht weergegeven dat er ongeveer als volgt uitziet:

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.", ... }}}

Oorzaak

Waarschijnlijk probeert u een beleid te maken dat al bestaat, mogelijk op basis van een eerdere configuratie.

Oplossing

  1. Controleer uw syntaxis en of u de juiste tenant-id gebruikt.

  2. Gebruik de opdracht Get-MgPolicyCrossTenantAccessPolicyPartnerIdentitySynchronization om de IsSyncAllowed instelling weer te geven.

    (Get-MgPolicyCrossTenantAccessPolicyPartnerIdentitySynchronization -CrossTenantAccessPolicyConfigurationPartnerTenantId $SourceTenantId).UserSyncInbound
    
  3. Als u een bestaand beleid hebt, moet u mogelijk een update uitvoeren met de opdracht Set-MgPolicyCrossTenantAccessPolicyPartnerIdentitySynchronization om gebruikerssynchronisatie in te schakelen.

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

Volgende stappen