Share via


Windows-based Hosting::CreateCustomerDatabase

This procedure creates a database for a specified customer and optionally creates a customer directory structure on a specified share for data (mdf) and log (ldf) file.

Note

The provisioning system only supports databases greater than 1 MB in size.

Arguments

Input Arguments Description

<orgLdapPath>

The Lightweight Directory Access Protocol (LDAP) path of the owning organization.

<optionalArgument>

<foreignobjectArgument>

<serverName>

A string representing the name of the server to provision the database on. If this element is not provided a server will be selected by resource manager.

<databaseName>

The name of the database to be created.

<dataRootShareName>

This is the name the share where customer data (mdf) and logfiles are store (ldf). This path, which is a combination of serverName and dataRootShare must be accessible via the MPF server and the account that is submitting this request must have permissions to create directories on that share (e.g. customerData$).

<serviceAcct>

This attribute is the sAMAccountName of the service account that the SQL Server runs as. This is required in order to provide file permission rights to the account for the customer's data and log files.

<dataRootPath>

This is the local path to the root directory where customer data (mdf) and logfiles are store (ldf).

<algorithm>

Defines the server candidate selection behavior. The allowed values are (note these are case sensitive):

  • tightPack: From the set of servers that can satisfy the capacity of an allocation, the servers are ranked favoring those with the least amount of free space.

  • level: From the set of servers that can satisfy the capacity of an allocation, the servers are ranked favoring those with the most amount of free space.

  • minSeverCount: From the set of servers that can satisfy the capacity of an allocation, servers are selected where the organization has already had databases allocated. If no appropriate servers are found meeting this criteria, then the procedure falls back to a "tightPack" algorithm or the algorithm specified in the @alternate optional parameter.

<preferredDomainController>

<sendCredentials>

<megabytes>

The size to be allocated to the resource.

<sqlUserName>

User name for connecting to the SQL Server via SQL Authentication. If this node is present, the connection will be made via SQL Authentication rather than Windows Authentication. The existence of this node also requires that the <sqlUserPass/> node exist.

<sqlUserPass>

The password for connecting to the SQL Server via SQL Authentication, using the username indicated by <sqlUserName/>. If the <sqlUserName/> node is not present, this node is ignored.

<dataFile>/<logicalName>

Logical name for the file. If you intend to supply any of the optional dataFile parameters, you must set the logical name of the data file.

<dataFile>/<fileMaxSize>

Maximum size in MB Requires that the dataFile/logicalName node exist and be non-null.

<dataFile>/<fileGrowth>

Designates a growth increment in KB, MB, GB, terabyte, or percentage (you must specify the unit). The default is 10 percent and the minimum value is 64 KB. Requires that the dataFile/logicalName node exist and be non-null.

<logFile>/<logicalName>

Logical name for the file. If no log file is specified, a single log file is created with a system-generated name and size that is 25 percent of total data file size. If you intend to supply any of the optional logFile parameters, you must set the logical name of the data file.

<logFile>/<fileMaxSize>

Maximum size in MB. Requires that the logFile/logicalName node exist and be non-null.

<logFile>/<fileGrowth>

Designates a growth increment in KB, MB, GB, terabyte, or percentage (you must specify the unit). The default is 10 percent and the minimum value is 64 KB. Requires that the logFile/logicalName node exist and be non-null.

< alternate>

Defines the alternate algorithm behavior if the minServerCount algorithm fails to find a candidate server. If provided, this alternate will be used to select the server candidate. If not provided the procedure will default to a "tightPack" alternate. This optional attribute is ignored for all algorithm values except "minServerCount."

Remarks

Method Syntax

public string   CreateCustomerDatabase( 
                                        string orgLdapPath,  
                                        string serverName, 
                                        string databaseName,  
                                        string preferredDomainController,  
                                        string sqlUserName,  
                                        string sqlUserPass,  
                                        string dataRootShareName,  
                                        string serviceAcct,  
                                        string dataRootPath,  
                                        string dataFileXmlString,  
                                        string logFileXmlString, 
                                        string algorithm,  
                                        string alternate, 
                                        string megabytes, 
                                        bool sendCredentials) 

Sample Code

Example XML Request

No example XML request.

Example XML Response

<response> 
  <data> 
    <orgLdapPath>LDAP://OU=WingTipToys,OU=consolidatedmessenger,OU=Hosting,DC=fabrikam,DC=Com</orgLdapPath> 
    <serverName>mps01-wh</serverName> 
    <databaseName>Impl1</databaseName> 
    <preferredDomainController>AD01-wh.fabrikam.com</preferredDomainController> 
    <megabytes>1</megabytes> 
    <algorithm alternate="level">minServerCount</algorithm> 
    <dataRootShare serviceAcct="fabrikam\MPSSQLService">temp</dataRootShare> 
    <dataRootPath>c:\temp</dataRootPath> 
    <dataFile> 
      <fileSize>99MB 
          </fileSize> 
    </dataFile> 
  </data> 
</response> 

Typical C# Usage

//Get user name and password.                            
        string userName = this.Request.ServerVariables.Get("AUTH_USER"); 
        string pass = this.Request.ServerVariables.Get("AUTH_PASSWORD"); 
 
        //Set credentials.       
        objWS.PreAuthenticate = true; 
        objWS.Credentials = new NetworkCredential(userName,pass); 
        lblMsg.InnerHtml = mpsResponseHeaderLabel; 
 
        //Display response. 
        this.mpsResponse.DocumentSource = ""; 
response = objWS.CreateCustomerDatabase(orgLdapPath, serverName, databaseName,  preferredDomainController, sqlUserName, sqlUserPass, dataRootShareName,  dataRootPath, dataFileXmlString, logFileXmlString, true); 
 
        // set the response XML to match the return from MPF 
        responseXml.LoadXml(response); 
        this.mpsResponse.Document = responseXml; 

Applies To

Managed Windows-based Hosting Web Service for:

  • Hosted Messaging and Collaboration version 3.5

  • Hosted Messaging and Collaboration version 3.0

  • Windows-based Hosting version 4.5

  • Windows-based Hosting version 4.0

  • Windows-based Hosting version 3.5

  • Windows-based Hosting for Applications version 1.0

See also

Tasks

Windows-based Hosting::DeleteCustomerDatabase
Windows-based Hosting::ModifyCustomerDatabaseFile