Namespace: microsoft.graph
Aktualisieren sie die Eigenschaften einer partnerspezifischen Konfiguration.
Diese API ist in den folgenden nationalen Cloudbereitstellungen verfügbar.
Weltweiter Service |
US Government L4 |
US Government L5 (DOD) |
China, betrieben von 21Vianet |
✅ |
✅ |
✅ |
✅ |
Berechtigungen
Wählen Sie die Berechtigungen aus, die für diese API als am wenigsten privilegiert markiert sind. Verwenden Sie eine höhere Berechtigung oder Berechtigungen nur, wenn Ihre App dies erfordert. Ausführliche Informationen zu delegierten Berechtigungen und Anwendungsberechtigungen finden Sie unter Berechtigungstypen. Weitere Informationen zu diesen Berechtigungen finden Sie in der Berechtigungsreferenz.
Berechtigungstyp |
Berechtigungen mit den geringsten Berechtigungen |
Berechtigungen mit höheren Berechtigungen |
Delegiert (Geschäfts-, Schul- oder Unikonto) |
Policy.ReadWrite.CrossTenantAccess |
Nicht verfügbar. |
Delegiert (persönliches Microsoft-Konto) |
Nicht unterstützt |
Nicht unterstützt |
Anwendung |
Policy.ReadWrite.CrossTenantAccess |
Nicht verfügbar. |
Wichtig
In delegierten Szenarien mit Geschäfts-, Schul- oder Unikonten, in denen der angemeldete Benutzer auf einen anderen Benutzer agiert, muss ihm eine unterstützte Microsoft Entra Rolle oder eine benutzerdefinierte Rolle mit einer unterstützten Rollenberechtigung zugewiesen werden. Die folgenden Rollen mit den geringsten Berechtigungen werden für diesen Vorgang unterstützt.
- Teams-Administrator – Ohne Einstellungen für die Identitätssynchronisierung
- Sicherheitsadministrator
HTTP-Anforderung
PATCH /policies/crossTenantAccessPolicy/partners/{id}
Anforderungstext
Geben Sie im Anforderungstext nur die Werte für zu aktualisierende Eigenschaften an. Vorhandene Eigenschaften, die nicht im Anforderungstext enthalten sind, behalten ihre vorherigen Werte bei oder werden basierend auf Änderungen an anderen Eigenschaftswerten neu berechnet.
In der folgenden Tabelle sind die Eigenschaften angegeben, die aktualisiert werden können.
Eigenschaft |
Typ |
Beschreibung |
automaticUserConsentSettings |
inboundOutboundPolicyConfiguration |
Bestimmt die partnerspezifische Konfiguration für einstellungen für die automatische Benutzereinwilligung. |
b2bCollaborationInbound |
crossTenantAccessPolicyB2BSetting |
Definiert Ihre partnerspezifische Konfiguration für Benutzer aus anderen Organisationen, die über Microsoft Entra B2B-Zusammenarbeit auf Ihre Ressourcen zugreifen. |
b2bCollaborationOutbound |
crossTenantAccessPolicyB2BSetting |
Definiert Ihre partnerspezifische Konfiguration für Benutzer in Ihrem organization ausgehend, um über Microsoft Entra B2B-Zusammenarbeit auf Ressourcen in einem anderen organization zuzugreifen. |
b2bDirectConnectInbound |
crossTenantAccessPolicyB2BSetting |
Definiert Ihre partnerspezifische Konfiguration für Benutzer aus anderen Organisationen, die über Microsoft Entra B2B Direct Connect auf Ihre Ressourcen zugreifen. |
b2bDirectConnectOutbound |
crossTenantAccessPolicyB2BSetting |
Definiert Ihre partnerspezifische Konfiguration für Benutzer in Ihrem organization ausgehend, um über Microsoft Entra direkte B2B-Verbindung auf Ressourcen in einem anderen organization zuzugreifen. |
inboundTrust |
crossTenantAccessPolicyInboundTrust |
Bestimmt die partnerspezifische Konfiguration zum Vertrauen anderer Ansprüche für bedingten Zugriff von externen Microsoft Entra Organisationen. |
tenantRestrictions |
crossTenantAccessPolicyTenantRestrictions |
Definiert die Standardkonfiguration für Mandanteneinschränkungen für Benutzer in Ihrem organization, die auf ein externes organization in Ihrem Netzwerk oder auf Ihren Geräten zugreifen. |
Antwort
Wenn die Methode erfolgreich verläuft, wird der Antwortcode 204 No Content
zurückgegeben.
Beispiele
Im folgenden Beispiel wird die partnerspezifische Richtlinie konfiguriert, indem die Einstellungen für die eingehende Vertrauensstellung so festgelegt werden, dass MFA, kompatible und Microsoft Entra hybrid eingebundenen Geräten aus dem Partnermandanten akzeptiert werden.
Anforderung
Das folgende Beispiel zeigt eine Anfrage.
PATCH https://graph.microsoft.com/v1.0/policies/crossTenantAccessPolicy/partners/90e29127-71ad-49c7-9ce8-db3f41ea06f1
Content-Type: application/json
{
"inboundTrust": {
"isMfaAccepted": true,
"isCompliantDeviceAccepted": true,
"isHybridAzureADJoinedDeviceAccepted": true
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new CrossTenantAccessPolicyConfigurationPartner
{
InboundTrust = new CrossTenantAccessPolicyInboundTrust
{
IsMfaAccepted = true,
IsCompliantDeviceAccepted = true,
IsHybridAzureADJoinedDeviceAccepted = true,
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Policies.CrossTenantAccessPolicy.Partners["{crossTenantAccessPolicyConfigurationPartner-tenantId}"].PatchAsync(requestBody);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
mgc policies cross-tenant-access-policy partners patch --cross-tenant-access-policy-configuration-partner-tenant-id {crossTenantAccessPolicyConfigurationPartner-tenantId} --body '{\
"inboundTrust": {\
"isMfaAccepted": true,\
"isCompliantDeviceAccepted": true,\
"isHybridAzureADJoinedDeviceAccepted": true\
}\
}\
'
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewCrossTenantAccessPolicyConfigurationPartner()
inboundTrust := graphmodels.NewCrossTenantAccessPolicyInboundTrust()
isMfaAccepted := true
inboundTrust.SetIsMfaAccepted(&isMfaAccepted)
isCompliantDeviceAccepted := true
inboundTrust.SetIsCompliantDeviceAccepted(&isCompliantDeviceAccepted)
isHybridAzureADJoinedDeviceAccepted := true
inboundTrust.SetIsHybridAzureADJoinedDeviceAccepted(&isHybridAzureADJoinedDeviceAccepted)
requestBody.SetInboundTrust(inboundTrust)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
partners, err := graphClient.Policies().CrossTenantAccessPolicy().Partners().ByCrossTenantAccessPolicyConfigurationPartnerTenantId("crossTenantAccessPolicyConfigurationPartner-tenantId").Patch(context.Background(), requestBody, nil)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
CrossTenantAccessPolicyConfigurationPartner crossTenantAccessPolicyConfigurationPartner = new CrossTenantAccessPolicyConfigurationPartner();
CrossTenantAccessPolicyInboundTrust inboundTrust = new CrossTenantAccessPolicyInboundTrust();
inboundTrust.setIsMfaAccepted(true);
inboundTrust.setIsCompliantDeviceAccepted(true);
inboundTrust.setIsHybridAzureADJoinedDeviceAccepted(true);
crossTenantAccessPolicyConfigurationPartner.setInboundTrust(inboundTrust);
CrossTenantAccessPolicyConfigurationPartner result = graphClient.policies().crossTenantAccessPolicy().partners().byCrossTenantAccessPolicyConfigurationPartnerTenantId("{crossTenantAccessPolicyConfigurationPartner-tenantId}").patch(crossTenantAccessPolicyConfigurationPartner);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
const options = {
authProvider,
};
const client = Client.init(options);
const crossTenantAccessPolicyConfigurationPartner = {
inboundTrust: {
isMfaAccepted: true,
isCompliantDeviceAccepted: true,
isHybridAzureADJoinedDeviceAccepted: true
}
};
await client.api('/policies/crossTenantAccessPolicy/partners/90e29127-71ad-49c7-9ce8-db3f41ea06f1')
.update(crossTenantAccessPolicyConfigurationPartner);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\CrossTenantAccessPolicyConfigurationPartner;
use Microsoft\Graph\Generated\Models\CrossTenantAccessPolicyInboundTrust;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new CrossTenantAccessPolicyConfigurationPartner();
$inboundTrust = new CrossTenantAccessPolicyInboundTrust();
$inboundTrust->setIsMfaAccepted(true);
$inboundTrust->setIsCompliantDeviceAccepted(true);
$inboundTrust->setIsHybridAzureADJoinedDeviceAccepted(true);
$requestBody->setInboundTrust($inboundTrust);
$result = $graphServiceClient->policies()->crossTenantAccessPolicy()->partners()->byCrossTenantAccessPolicyConfigurationPartnerTenantId('crossTenantAccessPolicyConfigurationPartner-tenantId')->patch($requestBody)->wait();
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
Import-Module Microsoft.Graph.Identity.SignIns
$params = @{
inboundTrust = @{
isMfaAccepted = $true
isCompliantDeviceAccepted = $true
isHybridAzureADJoinedDeviceAccepted = $true
}
}
Update-MgPolicyCrossTenantAccessPolicyPartner -CrossTenantAccessPolicyConfigurationPartnerTenantId $crossTenantAccessPolicyConfigurationPartnerTenantId -BodyParameter $params
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.cross_tenant_access_policy_configuration_partner import CrossTenantAccessPolicyConfigurationPartner
from msgraph.generated.models.cross_tenant_access_policy_inbound_trust import CrossTenantAccessPolicyInboundTrust
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = CrossTenantAccessPolicyConfigurationPartner(
inbound_trust = CrossTenantAccessPolicyInboundTrust(
is_mfa_accepted = True,
is_compliant_device_accepted = True,
is_hybrid_azure_a_d_joined_device_accepted = True,
),
)
result = await graph_client.policies.cross_tenant_access_policy.partners.by_cross_tenant_access_policy_configuration_partner_tenant_id('crossTenantAccessPolicyConfigurationPartner-tenantId').patch(request_body)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
Antwort
Das folgende Beispiel zeigt die Antwort.
HTTP/1.1 204 No Content
Im folgenden Beispiel wird die partnerspezifische Richtlinie konfiguriert, indem sie für die B2B-Zusammenarbeit im Namen Ihrer Benutzer einwilligt und die Administratoreinwilligung für die Benutzer des Partners akzeptiert.
Anforderung
Das folgende Beispiel zeigt eine Anfrage.
PATCH https://graph.microsoft.com/v1.0/policies/crossTenantAccessPolicy/partners/90e29127-71ad-49c7-9ce8-db3f41ea06f1
Content-Type: application/json
{
"automaticUserConsentSettings": {
"inboundAllowed": true,
"outboundAllowed": true
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new CrossTenantAccessPolicyConfigurationPartner
{
AutomaticUserConsentSettings = new InboundOutboundPolicyConfiguration
{
InboundAllowed = true,
OutboundAllowed = true,
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Policies.CrossTenantAccessPolicy.Partners["{crossTenantAccessPolicyConfigurationPartner-tenantId}"].PatchAsync(requestBody);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewCrossTenantAccessPolicyConfigurationPartner()
automaticUserConsentSettings := graphmodels.NewInboundOutboundPolicyConfiguration()
inboundAllowed := true
automaticUserConsentSettings.SetInboundAllowed(&inboundAllowed)
outboundAllowed := true
automaticUserConsentSettings.SetOutboundAllowed(&outboundAllowed)
requestBody.SetAutomaticUserConsentSettings(automaticUserConsentSettings)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
partners, err := graphClient.Policies().CrossTenantAccessPolicy().Partners().ByCrossTenantAccessPolicyConfigurationPartnerTenantId("crossTenantAccessPolicyConfigurationPartner-tenantId").Patch(context.Background(), requestBody, nil)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
CrossTenantAccessPolicyConfigurationPartner crossTenantAccessPolicyConfigurationPartner = new CrossTenantAccessPolicyConfigurationPartner();
InboundOutboundPolicyConfiguration automaticUserConsentSettings = new InboundOutboundPolicyConfiguration();
automaticUserConsentSettings.setInboundAllowed(true);
automaticUserConsentSettings.setOutboundAllowed(true);
crossTenantAccessPolicyConfigurationPartner.setAutomaticUserConsentSettings(automaticUserConsentSettings);
CrossTenantAccessPolicyConfigurationPartner result = graphClient.policies().crossTenantAccessPolicy().partners().byCrossTenantAccessPolicyConfigurationPartnerTenantId("{crossTenantAccessPolicyConfigurationPartner-tenantId}").patch(crossTenantAccessPolicyConfigurationPartner);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
const options = {
authProvider,
};
const client = Client.init(options);
const crossTenantAccessPolicyConfigurationPartner = {
automaticUserConsentSettings: {
inboundAllowed: true,
outboundAllowed: true
}
};
await client.api('/policies/crossTenantAccessPolicy/partners/90e29127-71ad-49c7-9ce8-db3f41ea06f1')
.update(crossTenantAccessPolicyConfigurationPartner);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\CrossTenantAccessPolicyConfigurationPartner;
use Microsoft\Graph\Generated\Models\InboundOutboundPolicyConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new CrossTenantAccessPolicyConfigurationPartner();
$automaticUserConsentSettings = new InboundOutboundPolicyConfiguration();
$automaticUserConsentSettings->setInboundAllowed(true);
$automaticUserConsentSettings->setOutboundAllowed(true);
$requestBody->setAutomaticUserConsentSettings($automaticUserConsentSettings);
$result = $graphServiceClient->policies()->crossTenantAccessPolicy()->partners()->byCrossTenantAccessPolicyConfigurationPartnerTenantId('crossTenantAccessPolicyConfigurationPartner-tenantId')->patch($requestBody)->wait();
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
Import-Module Microsoft.Graph.Identity.SignIns
$params = @{
automaticUserConsentSettings = @{
inboundAllowed = $true
outboundAllowed = $true
}
}
Update-MgPolicyCrossTenantAccessPolicyPartner -CrossTenantAccessPolicyConfigurationPartnerTenantId $crossTenantAccessPolicyConfigurationPartnerTenantId -BodyParameter $params
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.cross_tenant_access_policy_configuration_partner import CrossTenantAccessPolicyConfigurationPartner
from msgraph.generated.models.inbound_outbound_policy_configuration import InboundOutboundPolicyConfiguration
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = CrossTenantAccessPolicyConfigurationPartner(
automatic_user_consent_settings = InboundOutboundPolicyConfiguration(
inbound_allowed = True,
outbound_allowed = True,
),
)
result = await graph_client.policies.cross_tenant_access_policy.partners.by_cross_tenant_access_policy_configuration_partner_tenant_id('crossTenantAccessPolicyConfigurationPartner-tenantId').patch(request_body)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
Antwort
Das folgende Beispiel zeigt die Antwort.
HTTP/1.1 204 No Content
Das folgende Beispiel zeigt, wie Einstellungen für Mandanteneinschränkungen konfiguriert werden.
Anforderung
Das folgende Beispiel zeigt eine Anfrage.
PATCH https://graph.microsoft.com/beta/policies/crossTenantAccessPolicy/partners/90e29127-71ad-49c7-9ce8-db3f41ea06f1
Content-Type: application/json
{
"tenantRestrictions": {
"usersAndGroups": {
"accessType": "allowed",
"targets": [
{
"target": "AllUsers",
"targetType": "user"
}
]
},
"applications": {
"accessType": "allowed",
"targets": [
{
"target": "Office365",
"targetType": "application"
}
]
}
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new CrossTenantAccessPolicyConfigurationPartner
{
TenantRestrictions = new CrossTenantAccessPolicyTenantRestrictions
{
UsersAndGroups = new CrossTenantAccessPolicyTargetConfiguration
{
AccessType = CrossTenantAccessPolicyTargetConfigurationAccessType.Allowed,
Targets = new List<CrossTenantAccessPolicyTarget>
{
new CrossTenantAccessPolicyTarget
{
Target = "AllUsers",
TargetType = CrossTenantAccessPolicyTargetType.User,
},
},
},
Applications = new CrossTenantAccessPolicyTargetConfiguration
{
AccessType = CrossTenantAccessPolicyTargetConfigurationAccessType.Allowed,
Targets = new List<CrossTenantAccessPolicyTarget>
{
new CrossTenantAccessPolicyTarget
{
Target = "Office365",
TargetType = CrossTenantAccessPolicyTargetType.Application,
},
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Policies.CrossTenantAccessPolicy.Partners["{crossTenantAccessPolicyConfigurationPartner-tenantId}"].PatchAsync(requestBody);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
mgc-beta policies cross-tenant-access-policy partners patch --cross-tenant-access-policy-configuration-partner-tenant-id {crossTenantAccessPolicyConfigurationPartner-tenantId} --body '{\
"tenantRestrictions": {\
"usersAndGroups": {\
"accessType": "allowed",\
"targets": [\
{\
"target": "AllUsers",\
"targetType": "user"\
}\
]\
},\
"applications": {\
"accessType": "allowed",\
"targets": [\
{\
"target": "Office365",\
"targetType": "application"\
}\
]\
}\
}\
}\
'
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewCrossTenantAccessPolicyConfigurationPartner()
tenantRestrictions := graphmodels.NewCrossTenantAccessPolicyTenantRestrictions()
usersAndGroups := graphmodels.NewCrossTenantAccessPolicyTargetConfiguration()
accessType := graphmodels.ALLOWED_CROSSTENANTACCESSPOLICYTARGETCONFIGURATIONACCESSTYPE
usersAndGroups.SetAccessType(&accessType)
crossTenantAccessPolicyTarget := graphmodels.NewCrossTenantAccessPolicyTarget()
target := "AllUsers"
crossTenantAccessPolicyTarget.SetTarget(&target)
targetType := graphmodels.USER_CROSSTENANTACCESSPOLICYTARGETTYPE
crossTenantAccessPolicyTarget.SetTargetType(&targetType)
targets := []graphmodels.CrossTenantAccessPolicyTargetable {
crossTenantAccessPolicyTarget,
}
usersAndGroups.SetTargets(targets)
tenantRestrictions.SetUsersAndGroups(usersAndGroups)
applications := graphmodels.NewCrossTenantAccessPolicyTargetConfiguration()
accessType := graphmodels.ALLOWED_CROSSTENANTACCESSPOLICYTARGETCONFIGURATIONACCESSTYPE
applications.SetAccessType(&accessType)
crossTenantAccessPolicyTarget := graphmodels.NewCrossTenantAccessPolicyTarget()
target := "Office365"
crossTenantAccessPolicyTarget.SetTarget(&target)
targetType := graphmodels.APPLICATION_CROSSTENANTACCESSPOLICYTARGETTYPE
crossTenantAccessPolicyTarget.SetTargetType(&targetType)
targets := []graphmodels.CrossTenantAccessPolicyTargetable {
crossTenantAccessPolicyTarget,
}
applications.SetTargets(targets)
tenantRestrictions.SetApplications(applications)
requestBody.SetTenantRestrictions(tenantRestrictions)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
partners, err := graphClient.Policies().CrossTenantAccessPolicy().Partners().ByCrossTenantAccessPolicyConfigurationPartnerTenantId("crossTenantAccessPolicyConfigurationPartner-tenantId").Patch(context.Background(), requestBody, nil)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
CrossTenantAccessPolicyConfigurationPartner crossTenantAccessPolicyConfigurationPartner = new CrossTenantAccessPolicyConfigurationPartner();
CrossTenantAccessPolicyTenantRestrictions tenantRestrictions = new CrossTenantAccessPolicyTenantRestrictions();
CrossTenantAccessPolicyTargetConfiguration usersAndGroups = new CrossTenantAccessPolicyTargetConfiguration();
usersAndGroups.setAccessType(CrossTenantAccessPolicyTargetConfigurationAccessType.Allowed);
LinkedList<CrossTenantAccessPolicyTarget> targets = new LinkedList<CrossTenantAccessPolicyTarget>();
CrossTenantAccessPolicyTarget crossTenantAccessPolicyTarget = new CrossTenantAccessPolicyTarget();
crossTenantAccessPolicyTarget.setTarget("AllUsers");
crossTenantAccessPolicyTarget.setTargetType(CrossTenantAccessPolicyTargetType.User);
targets.add(crossTenantAccessPolicyTarget);
usersAndGroups.setTargets(targets);
tenantRestrictions.setUsersAndGroups(usersAndGroups);
CrossTenantAccessPolicyTargetConfiguration applications = new CrossTenantAccessPolicyTargetConfiguration();
applications.setAccessType(CrossTenantAccessPolicyTargetConfigurationAccessType.Allowed);
LinkedList<CrossTenantAccessPolicyTarget> targets1 = new LinkedList<CrossTenantAccessPolicyTarget>();
CrossTenantAccessPolicyTarget crossTenantAccessPolicyTarget1 = new CrossTenantAccessPolicyTarget();
crossTenantAccessPolicyTarget1.setTarget("Office365");
crossTenantAccessPolicyTarget1.setTargetType(CrossTenantAccessPolicyTargetType.Application);
targets1.add(crossTenantAccessPolicyTarget1);
applications.setTargets(targets1);
tenantRestrictions.setApplications(applications);
crossTenantAccessPolicyConfigurationPartner.setTenantRestrictions(tenantRestrictions);
CrossTenantAccessPolicyConfigurationPartner result = graphClient.policies().crossTenantAccessPolicy().partners().byCrossTenantAccessPolicyConfigurationPartnerTenantId("{crossTenantAccessPolicyConfigurationPartner-tenantId}").patch(crossTenantAccessPolicyConfigurationPartner);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
const options = {
authProvider,
};
const client = Client.init(options);
const crossTenantAccessPolicyConfigurationPartner = {
tenantRestrictions: {
usersAndGroups: {
accessType: 'allowed',
targets: [
{
target: 'AllUsers',
targetType: 'user'
}
]
},
applications: {
accessType: 'allowed',
targets: [
{
target: 'Office365',
targetType: 'application'
}
]
}
}
};
await client.api('/policies/crossTenantAccessPolicy/partners/90e29127-71ad-49c7-9ce8-db3f41ea06f1')
.version('beta')
.update(crossTenantAccessPolicyConfigurationPartner);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\CrossTenantAccessPolicyConfigurationPartner;
use Microsoft\Graph\Beta\Generated\Models\CrossTenantAccessPolicyTenantRestrictions;
use Microsoft\Graph\Beta\Generated\Models\CrossTenantAccessPolicyTargetConfiguration;
use Microsoft\Graph\Beta\Generated\Models\CrossTenantAccessPolicyTargetConfigurationAccessType;
use Microsoft\Graph\Beta\Generated\Models\CrossTenantAccessPolicyTarget;
use Microsoft\Graph\Beta\Generated\Models\CrossTenantAccessPolicyTargetType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new CrossTenantAccessPolicyConfigurationPartner();
$tenantRestrictions = new CrossTenantAccessPolicyTenantRestrictions();
$tenantRestrictionsUsersAndGroups = new CrossTenantAccessPolicyTargetConfiguration();
$tenantRestrictionsUsersAndGroups->setAccessType(new CrossTenantAccessPolicyTargetConfigurationAccessType('allowed'));
$targetsCrossTenantAccessPolicyTarget1 = new CrossTenantAccessPolicyTarget();
$targetsCrossTenantAccessPolicyTarget1->setTarget('AllUsers');
$targetsCrossTenantAccessPolicyTarget1->setTargetType(new CrossTenantAccessPolicyTargetType('user'));
$targetsArray []= $targetsCrossTenantAccessPolicyTarget1;
$tenantRestrictionsUsersAndGroups->setTargets($targetsArray);
$tenantRestrictions->setUsersAndGroups($tenantRestrictionsUsersAndGroups);
$tenantRestrictionsApplications = new CrossTenantAccessPolicyTargetConfiguration();
$tenantRestrictionsApplications->setAccessType(new CrossTenantAccessPolicyTargetConfigurationAccessType('allowed'));
$targetsCrossTenantAccessPolicyTarget1 = new CrossTenantAccessPolicyTarget();
$targetsCrossTenantAccessPolicyTarget1->setTarget('Office365');
$targetsCrossTenantAccessPolicyTarget1->setTargetType(new CrossTenantAccessPolicyTargetType('application'));
$targetsArray []= $targetsCrossTenantAccessPolicyTarget1;
$tenantRestrictionsApplications->setTargets($targetsArray);
$tenantRestrictions->setApplications($tenantRestrictionsApplications);
$requestBody->setTenantRestrictions($tenantRestrictions);
$result = $graphServiceClient->policies()->crossTenantAccessPolicy()->partners()->byCrossTenantAccessPolicyConfigurationPartnerTenantId('crossTenantAccessPolicyConfigurationPartner-tenantId')->patch($requestBody)->wait();
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
Import-Module Microsoft.Graph.Beta.Identity.SignIns
$params = @{
tenantRestrictions = @{
usersAndGroups = @{
accessType = "allowed"
targets = @(
@{
target = "AllUsers"
targetType = "user"
}
)
}
applications = @{
accessType = "allowed"
targets = @(
@{
target = "Office365"
targetType = "application"
}
)
}
}
}
Update-MgBetaPolicyCrossTenantAccessPolicyPartner -CrossTenantAccessPolicyConfigurationPartnerTenantId $crossTenantAccessPolicyConfigurationPartnerTenantId -BodyParameter $params
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.cross_tenant_access_policy_configuration_partner import CrossTenantAccessPolicyConfigurationPartner
from msgraph_beta.generated.models.cross_tenant_access_policy_tenant_restrictions import CrossTenantAccessPolicyTenantRestrictions
from msgraph_beta.generated.models.cross_tenant_access_policy_target_configuration import CrossTenantAccessPolicyTargetConfiguration
from msgraph_beta.generated.models.cross_tenant_access_policy_target_configuration_access_type import CrossTenantAccessPolicyTargetConfigurationAccessType
from msgraph_beta.generated.models.cross_tenant_access_policy_target import CrossTenantAccessPolicyTarget
from msgraph_beta.generated.models.cross_tenant_access_policy_target_type import CrossTenantAccessPolicyTargetType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = CrossTenantAccessPolicyConfigurationPartner(
tenant_restrictions = CrossTenantAccessPolicyTenantRestrictions(
users_and_groups = CrossTenantAccessPolicyTargetConfiguration(
access_type = CrossTenantAccessPolicyTargetConfigurationAccessType.Allowed,
targets = [
CrossTenantAccessPolicyTarget(
target = "AllUsers",
target_type = CrossTenantAccessPolicyTargetType.User,
),
],
),
applications = CrossTenantAccessPolicyTargetConfiguration(
access_type = CrossTenantAccessPolicyTargetConfigurationAccessType.Allowed,
targets = [
CrossTenantAccessPolicyTarget(
target = "Office365",
target_type = CrossTenantAccessPolicyTargetType.Application,
),
],
),
),
)
result = await graph_client.policies.cross_tenant_access_policy.partners.by_cross_tenant_access_policy_configuration_partner_tenant_id('crossTenantAccessPolicyConfigurationPartner-tenantId').patch(request_body)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
Antwort
Das folgende Beispiel zeigt die Antwort.
HTTP/1.1 204 No Content