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
Connect to the
Adminservice.Create a new instance of the
SpfAdmin.Tenantclass.Set the
Nameproperty of the tenant.Call the
Admin.AddToTenantsmethod and pass in the new tenant instance.Call the
Admin.SaveChangesmethod.
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 |