Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies To: System Center 2016 - Service Provider Foundation, System Center Technical Preview
In Service Provider Foundation, you can add a stamp instance to a tenant through a link. The link that you create associates the tenant with the stamp instance with each other. By using the service object, you can add a link between two objects by calling the AddLink method, which passes in the source object, the source property name, and the target object. When a stamp is associated with a tenant, a corresponding Virtual Machine Manager (VMM) tenant administrator user role is created on the server that the stamp is assigned to.
To assign a stamp to a tenant
- Connect to the - Adminservice.
- Get an existing - SpfAdmin.Tenantobject.
- Get an existing - SpfAdmin.Stampobject.
- Call the - Admin.AddLinkmethod. Pass the tenant instance as the first parameter, and supply the string "Stamps" for the second parameter. Pass the stamp instance for the third parameter.
- Call the - Admin.SaveChangesmethod.
Example
The following 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 = adminService.Tenants.Where(t => t.ID == new Guid("1E624759-0B2E-471F-A833-E432F1DB35AB")).FirstOrDefault();  
SpfAdmin.Stamp stamp = adminService.Stamps.Where(s => s.ID == new Guid("1ABD8C2B-977C-4511-AD68-ACAF6F923B82")).FirstOrDefault();  
  
if (stamp != null && tenant != null)  
{  
    adminService.AddLink(tenant, "Stamps", stamp);  
    adminService.SaveChanges();  
}  
  
Compiling the Code
Assemblies
| System | 
| System.Core | 
Namespaces
| System | 
| System.Linq |