Sorry, search feature is not supported in Internet Explorer 11

IAdmO365Container3

The IAdmO365Container3 interface extends the IAdmO365Container interface with the ability to specify application credential and a national cloud for Microsoft 365 tenant registration.

Inheritance: IAdmO365Container2

Methods

Details

CreateCredential()

Creates an object that represents Microsoft 365 tenant credential of the specified type. Depending on the type, the object will support either the IAdmO365AppSecretTenantCredential or IAdmO365UsernamePwdTenantCredential interface.

IAdmO365TenantCredential CreateCredential(ADM_O365TENANT_CREDTYPE_ENUM credentialType)

CreateRegistrationParams()

Returns the IAdmO365TenantRegistrationParams interface used to specify parameters for registering a Microsoft 365 tenant.

IAdmO365TenantRegistrationParams CreateRegistrationParams()

RegisterTenant2()

Registers a Microsoft 365 tenant in Adaxes. Unlike method IAdmO365Container::RegisterTenant, this method allows you to specify application credential and a national cloud in the parameters for the tenant registration.

IAdmO365Tenant RegisterTenant2(IAdmO365TenantRegistrationParams registrationParams, Boolean checkOnly)

Parameters

  • registrationParams - Specifies parameters for the Microsoft 365 tenant registration. To create the parameters, use method CreateRegistrationParams().
  • checkOnly - If set to TRUE, the method only checks whether the Microsoft 365 tenant can be registered using the specified parameters.

Examples

The following code sample registers a Microsoft 365 tenant with application credential.

PowerShell
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$applicationId = "e97b76b5-1e24-4d96-b251-1f938cb6459f"
$tenantId = "a5885e21-2ba8-4195-9a88-3756d1fe9023"
$clientSecret = "fK7--~yjs1fH8U9m5heb_VQyHBOybZlEOc"

# Connect to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Bind to the 'Microsoft 365' container
$containerPath = $admService.Backend.GetConfigurationContainerPath("CloudServicesO365")
$container = $admService.OpenObject($containerPath.ToString(),$NULL, $NULL, 0)

# Register tenant
$credential = $container.CreateCredential("ADM_O365TENANT_CREDTYPE_APPSECRET")
$credential.AppId = $applicationId
$credential.TenantId = $tenantId
$credential.SetSecret($clientSecret)

$parameters = $container.CreateRegistrationParams()
$parameters.Credential = $credential

$container.RegisterTenant2($parameters, $False)
C#
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi.CloudServices.Office365;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;

class Program
{
    static void Main(string[] args)
    {
        const string applicationId = "76bc664d-b6d1-41b6-b589-409416161c32";
        const string tenantId = "a5765e21-2ba8-4195-9a88-3756d1fe9453";
        const string clientSecret = "WIz6SBuc7-~1g6A-HJ7q~A8g04G66Q_5ep";

        // Connect to the Adaxes service
        AdmNamespace adsNS = new AdmNamespace();
        IAdmService admService = adsNS.GetServiceDirectly("localhost");

        // Bind to the 'Microsoft 365' container
        string configurationContainerPath = admService.Backend.GetConfigurationContainerPath(
            "CloudServicesO365");
        IAdmO365Container3 container = (IAdmO365Container3)admService.OpenObject(
            configurationContainerPath, null, null, 0);

        // Register tenant
        IAdmO365AppSecretTenantCredential credential = 
            (IAdmO365AppSecretTenantCredential)container.CreateCredential(
                ADM_O365TENANT_CREDTYPE_ENUM.ADM_O365TENANT_CREDTYPE_APPSECRET);
        credential.AppId = applicationId;
        credential.TenantId = tenantId;
        credential.SetSecret(clientSecret);

        IAdmO365TenantRegistrationParams parameters = container.CreateRegistrationParams();
        parameters.Credential = credential;

        container.RegisterTenant2(parameters, false);
    }
}

Requirements

Minimum required version: 2021.1

See also