Redigera

Dela via


Add multiTenantOrganizationMember

Namespace: microsoft.graph

Add a tenant to a multitenant organization. The administrator of an owner tenant has the permissions to add tenants to the multitenant organization. The added tenant is in the pending state until the administrator of the added tenant joins the multitenant organization by submitting a join request. A tenant can be part of only one multitenant organization.

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

In delegated scenarios with work or school accounts, the signed-in user must be assigned a supported Microsoft Entra role or a custom role with a supported role permission. Security Administrator is the least privileged role supported for this operation.

HTTP request

POST /tenantRelationships/multiTenantOrganization/tenants

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json. Required.

Request body

In the request body, supply a JSON representation of the multiTenantOrganizationMember object.

You can specify the following properties when creating a multiTenantOrganizationMember.

Property Type Description
tenantId String Tenant ID of the Microsoft Entra tenant to add to the multitenant organization. Required.
displayName String Display name of the tenant added to the multitenant organization. Currently, can't be changed once set. Required.
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 201 Created response code and a multiTenantOrganizationMember object in the response body. If the tenant is already pending or active in this multitenant organization, you get a 'Request_BadRequest' error.

Examples

The following example adds the Fabrikam tenant to the multitenant organization.

Request

POST https://graph.microsoft.com/v1.0/tenantRelationships/multiTenantOrganization/tenants
Content-Type: application/json

{
  "tenantId": "4a12efe6-aa14-4d03-8dff-88fc89e2e2ad",
  "displayName": "Fabrikam"
}

Response

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

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#tenantRelationships/multiTenantOrganization/tenants/$entity",
    "tenantId": "4a12efe6-aa14-4d03-8dff-88fc89e2e2ad",
    "displayName": "Fabrikam",
    "addedDateTime": "2023-05-27T19:24:29Z",
    "joinedDateTime": null,
    "addedByTenantId": "1fd6544e-e994-4de2-9f1b-787b51c7d325",
    "role": "member",
    "state": "pending",
    "transitionDetails": null
}

If tenant is already pending or active in this multitenant organization, you get a 'Request_BadRequest' error.

HTTP/1.1 400 Bad Request
Content-Type: application/json

{
    "error": {
        "code": "Request_BadRequest",
        "message": "Tenant is already being added in Multi-Tenant Organization.",
        "innerError": {
            "date": "2023-05-27T20:56:14",
            "request-id": "a1e5973c-66f1-4853-9e3d-39e6b4f606d1",
            "client-request-id": "651548c3-e864-4509-837b-4f5d4cf546a5"
        }
    }
}