Function: Active Directory Create AD Host

by Simon Sparks · 7 February 2026

To use this function add it to the class library file named OrchestratorPluginADService.ts

GitHub Repository: https://github.com/SimonSparksUK/Orchestrator

Filename: OrchestratorPluginADService.ts

Private Function: createADHost

public createADHost(intPort: 389 | 636, strBindType: "Simple" | "Digest" = "Simple", strLoadBalancingMode: "SingleServer" | "Round-Robin" | "Failover" = "Failover", strName: string, strFQDN: string, strLdapBaseDn: string, strDefaultDomain: string, strUsername: string, strPassword: string, arrAlternativeFQDN: string[], blnUseSSL: boolean = true, blnFollowReferrals: boolean = true): string {

    let objADServerConfiguration: AD_ServerConfiguration = new AD_ServerConfiguration();
    objADServerConfiguration.name = strName;
    objADServerConfiguration.host = strFQDN;
    objADServerConfiguration.port = intPort;
    objADServerConfiguration.ldapBase = strLdapBaseDn;
    objADServerConfiguration.useSSL = blnUseSSL;
    objADServerConfiguration.defaultDomain = strDefaultDomain;
    objADServerConfiguration.sharedUserName = strUsername;
    objADServerConfiguration.sharedUserPassword = strPassword;
    objADServerConfiguration.alternativeHosts = arrAlternativeFQDN;
    objADServerConfiguration.followReferrals = blnFollowReferrals;
    // @ts-ignore
    objADServerConfiguration.loadBalancingMode = LdapLoadBalancingMode[strLoadBalancingMode];
    // @ts-ignore
    objADServerConfiguration.bindType = LdapBindType[strBindType];

    ConfigurationManager.validateConfiguration(objADServerConfiguration);

    let strConfigurationId: string = ConfigurationManager.saveConfiguration(objADServerConfiguration);

    return strConfigurationId;
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like