35 строки
1.7 KiB
Java
35 строки
1.7 KiB
Java
import com.azure.resourcemanager.scvmm.models.ExtendedLocation;
|
|
import com.azure.resourcemanager.scvmm.models.HardwareProfile;
|
|
|
|
/** Samples for VirtualMachines CreateOrUpdate. */
|
|
public final class Main {
|
|
/*
|
|
* x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateVirtualMachine.json
|
|
*/
|
|
/**
|
|
* Sample code: CreateVirtualMachine.
|
|
*
|
|
* @param manager Entry point to ScvmmManager.
|
|
*/
|
|
public static void createVirtualMachine(com.azure.resourcemanager.scvmm.ScvmmManager manager) {
|
|
manager
|
|
.virtualMachines()
|
|
.define("DemoVM")
|
|
.withRegion("East US")
|
|
.withExistingResourceGroup("testrg")
|
|
.withExtendedLocation(
|
|
new ExtendedLocation()
|
|
.withType("customLocation")
|
|
.withName(
|
|
"/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.Arc/customLocations/contoso"))
|
|
.withVmmServerId(
|
|
"/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.SCVMM/VMMServers/ContosoVMMServer")
|
|
.withCloudId(
|
|
"/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.SCVMM/Clouds/HRCloud")
|
|
.withTemplateId(
|
|
"/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.SCVMM/VirtualMachineTemplates/HRVirtualMachineTemplate")
|
|
.withHardwareProfile(new HardwareProfile().withMemoryMB(4096).withCpuCount(4))
|
|
.create();
|
|
}
|
|
}
|