Freigeben über


How to Create a New Tenant

 

Applies To: System Center 2016 - Service Provider Foundation, System Center Technical Preview

You can create a new tenant in Service Provider Foundation by creating an instance of the SpfAdmin.Tenant class. When you create an instance, you must supply a value for the Name property, which is a key property for the object. The name must be unique. To complete the process, you call the service’s AddToTenants method and pass pass in the tenant instance, and then call the service’s SaveChanges method to commit the changes.

To create a tenant

  1. Connect to the Admin service.

  2. Create a new instance of the SpfAdmin.Tenant class.

  3. Set the Name property of the tenant.

  4. Call the Admin.AddToTenants method and pass in the new tenant instance.

  5. Call the Admin.SaveChanges method.

Example

This code example connects to the administrative service and creates a new tenant. For more information, seeProgramming in Visual Studio with Service Provider Foundation Services.

  
SpfAdmin.Admin adminService = new SpfAdmin.Admin(new System.Uri(@"https://contoso:8090/SC2012/Admin/Microsoft.Management.Odata.svc/"));  
adminService.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;  
  
SpfAdmin.Tenant tenant = new SpfAdmin.Tenant();  
tenant.Name = "The tenant name";  
  
adminService.AddToTenants(tenant);  
adminService.SaveChanges();  
  

Compiling the Code

Assemblies

System

See Also

Tenants
Overview
How to Assign a Stamp to a Tenant