Namespace: microsoft.graph
Update the properties of a tenant in a multitenant organization. Only owner tenants can call this API.
This API is available in the following national cloud deployments.
| Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
| ✅ |
❌ |
❌ |
❌ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
| Permission type |
Least privileged permissions |
Higher privileged permissions |
| Delegated (work or school account) |
MultiTenantOrganization.ReadWrite.All |
Not available. |
| Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
| Application |
MultiTenantOrganization.ReadWrite.All |
Not available. |
Important
For delegated access using work or school accounts, the signed-in user must be assigned a supported Microsoft Entra role or a custom role that grants the permissions required for this operation. Security Administrator is the least privileged role supported for this operation.
HTTP request
PATCH /tenantRelationships/multiTenantOrganization/tenants/{tenantId}
Request body
In the request body, supply only the values for properties to update. Existing properties that aren't included in the request body maintain their previous values or are recalculated based on changes to other property values.
The following table specifies the properties that can be updated.
| Property |
Type |
Description |
| role |
multiTenantOrganizationMemberRole |
Role of the tenant in the multitenant organization. The possible values are: owner, member (default), unknownFutureValue. Optional. |
Response
If successful, this method returns a 204 No Content response code.
Examples
The following example changes the role of a tenant in a multitenant organization from member to owner.
Request
PATCH https://graph.microsoft.com/v1.0/tenantRelationships/multiTenantOrganization/tenants/5036a0a0-a7a4-4933-9086-5dd54535dd6e
Content-Type: application/json
{
"role": "owner"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new MultiTenantOrganizationMember
{
Role = MultiTenantOrganizationMemberRole.Owner,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.TenantRelationships.MultiTenantOrganization.Tenants["{multiTenantOrganizationMember-id}"].PatchAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// 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.NewMultiTenantOrganizationMember()
role := graphmodels.OWNER_MULTITENANTORGANIZATIONMEMBERROLE
requestBody.SetRole(&role)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
tenants, err := graphClient.TenantRelationships().MultiTenantOrganization().Tenants().ByMultiTenantOrganizationMemberId("multiTenantOrganizationMember-id").Patch(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
MultiTenantOrganizationMember multiTenantOrganizationMember = new MultiTenantOrganizationMember();
multiTenantOrganizationMember.setRole(MultiTenantOrganizationMemberRole.Owner);
MultiTenantOrganizationMember result = graphClient.tenantRelationships().multiTenantOrganization().tenants().byMultiTenantOrganizationMemberId("{multiTenantOrganizationMember-id}").patch(multiTenantOrganizationMember);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
const multiTenantOrganizationMember = {
role: 'owner'
};
await client.api('/tenantRelationships/multiTenantOrganization/tenants/5036a0a0-a7a4-4933-9086-5dd54535dd6e')
.update(multiTenantOrganizationMember);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\MultiTenantOrganizationMember;
use Microsoft\Graph\Generated\Models\MultiTenantOrganizationMemberRole;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new MultiTenantOrganizationMember();
$requestBody->setRole(new MultiTenantOrganizationMemberRole('owner'));
$result = $graphServiceClient->tenantRelationships()->multiTenantOrganization()->tenants()->byMultiTenantOrganizationMemberId('multiTenantOrganizationMember-id')->patch($requestBody)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Import-Module Microsoft.Graph.Identity.SignIns
$params = @{
role = "owner"
}
Update-MgTenantRelationshipMultiTenantOrganizationTenant -MultiTenantOrganizationMemberId $multiTenantOrganizationMemberId -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.multi_tenant_organization_member import MultiTenantOrganizationMember
from msgraph.generated.models.multi_tenant_organization_member_role import MultiTenantOrganizationMemberRole
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = MultiTenantOrganizationMember(
role = MultiTenantOrganizationMemberRole.Owner,
)
result = await graph_client.tenant_relationships.multi_tenant_organization.tenants.by_multi_tenant_organization_member_id('multiTenantOrganizationMember-id').patch(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
HTTP/1.1 204 No Content