For more information, see Virtual Machine Manager Service

URI Update

The guidance above describes how to perform operations on virtual machine resources directly. But like with other resource types, it is possible to interact with the virtual machine resource provider via the service management API proxy. To do so, update the URI specified in each of the code examples to a service management API proxy, as specified in the table below.

URI

Type

https://tenant-endpoint/{subscripiton-ID}/services/systemcenter/VMM/

Tenants

http://admin-endpoint/services/systemcenter/SC2012/VMM/Microsoft.Management.Odata.svc

Adminstrators

For example, the following code creates a virtual machine by interacting with the virtual machine manager resource provider directly.

  Copy Code

SpfVMM.VMM vmmService = new SpfVMM.VMM(new Uri("https://contoso:8090/SC2012/VMM/Microsoft.Management.Odata.svc/"));
vmmService.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

SpfVMM.VirtualMachine vm = new SpfVMM.VirtualMachine();
vm.Name = "Test Machine";
vm.CloudId = new Guid("62107714-182b-4f90-a3d1-97f5c6fd084e");
vm.StampId = new Guid("1abd8c2b-977c-4511-ad68-acaf6f923b82");
vm.VMTemplateId = new Guid("0e261f4a-350a-4f5a-abeb-ac24cb8f7275");

vmmService.AddToVirtualMachines(vm);
vmmService.SaveChanges();

To perform the same operation via the service management API proxy, the first line in the code may be updated in one of two possible ways, as shown below.

  Copy Code
SpfVMM.VMM vmmService = new SpfVMM.VMM(new Uri("https://tenant-endpoint/{subscripiton-ID}/services/systemcenter/VMM/"));
  Copy Code
SpfVMM.VMM vmmService = new SpfVMM.VMM(new Uri("http://admin-endpoint/services/systemcenter/SC2012/VMM/Microsoft.Management.Odata.svc "));