mirror of
https://github.com/apache/jclouds.git
synced 2025-02-11 20:46:11 +00:00
Adds methods listAll and listByLocation to VirtualMachineAPI (#21)
* Adds methods listAll and listByLocation to VirtualMachineAPI Adds Mock tests fixes * Minor comments * Overrides test to avoid case sensitive comparation * Adds comment to justify overriding base test method * Enables list by location to improve performance in listNodes abstraction * Returns all available VMs if no regions are specified
This commit is contained in:
parent
077dca824c
commit
75c5bc3fbb
@ -132,7 +132,7 @@ public interface AzureComputeApi extends Closeable {
|
|||||||
* @see <a href="https://msdn.microsoft.com/en-us/library/azure/mt163630.aspx">docs</a>
|
* @see <a href="https://msdn.microsoft.com/en-us/library/azure/mt163630.aspx">docs</a>
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
VirtualMachineApi getVirtualMachineApi(@PathParam("resourceGroup") String resourceGroup);
|
VirtualMachineApi getVirtualMachineApi(@Nullable @PathParam("resourceGroup") String resourceGroup);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Virtual Machine Scale Set API includes operations for managing the virtual machines in your subscription.
|
* The Virtual Machine Scale Set API includes operations for managing the virtual machines in your subscription.
|
||||||
|
@ -351,14 +351,12 @@ public class AzureComputeServiceAdapter implements ComputeServiceAdapter<Virtual
|
|||||||
@Override
|
@Override
|
||||||
public Iterable<VirtualMachine> listNodes() {
|
public Iterable<VirtualMachine> listNodes() {
|
||||||
ImmutableList.Builder<VirtualMachine> nodes = builder();
|
ImmutableList.Builder<VirtualMachine> nodes = builder();
|
||||||
for (ResourceGroup resourceGroup : api.getResourceGroupApi().list()) {
|
if (regionIds.get().isEmpty()) {
|
||||||
List<VirtualMachine> vms = api.getVirtualMachineApi(resourceGroup.name()).list();
|
nodes.addAll(api.getVirtualMachineApi(null).listAll());
|
||||||
nodes.addAll(filter(vms, new Predicate<VirtualMachine>() {
|
} else {
|
||||||
@Override
|
for (final String location : regionIds.get()) {
|
||||||
public boolean apply(VirtualMachine input) {
|
nodes.addAll(api.getVirtualMachineApi(null).listByLocation(location));
|
||||||
return regionIds.get().isEmpty() || regionIds.get().contains(input.location());
|
}
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
return nodes.build();
|
return nodes.build();
|
||||||
}
|
}
|
||||||
|
@ -55,14 +55,13 @@ import org.jclouds.rest.binders.BindToJsonPayload;
|
|||||||
*
|
*
|
||||||
* @see <a href="https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines">docs</a>
|
* @see <a href="https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines">docs</a>
|
||||||
*/
|
*/
|
||||||
@Path("/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines")
|
|
||||||
@RequestFilters({ OAuthFilter.class, ApiVersionFilter.class })
|
@RequestFilters({ OAuthFilter.class, ApiVersionFilter.class })
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
public interface VirtualMachineApi {
|
public interface VirtualMachineApi {
|
||||||
|
|
||||||
@Named("GetVirtualMachine")
|
@Named("GetVirtualMachine")
|
||||||
@GET
|
@GET
|
||||||
@Path("/{name}")
|
@Path("/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{name}")
|
||||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||||
VirtualMachine get(@PathParam("name") String name);
|
VirtualMachine get(@PathParam("name") String name);
|
||||||
|
|
||||||
@ -71,64 +70,77 @@ public interface VirtualMachineApi {
|
|||||||
*/
|
*/
|
||||||
@Named("GetVirtualMachineInstance")
|
@Named("GetVirtualMachineInstance")
|
||||||
@GET
|
@GET
|
||||||
@Path("/{name}/instanceView")
|
@Path("/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{name}/instanceView")
|
||||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||||
VirtualMachineInstance getInstanceDetails(@PathParam("name") String name);
|
VirtualMachineInstance getInstanceDetails(@PathParam("name") String name);
|
||||||
|
|
||||||
@Named("CreateOrUpdateVirtualMachine")
|
@Named("CreateOrUpdateVirtualMachine")
|
||||||
@PUT
|
@PUT
|
||||||
@MapBinder(BindToJsonPayload.class)
|
@MapBinder(BindToJsonPayload.class)
|
||||||
@Path("/{vmname}")
|
@Path("/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmname}")
|
||||||
@QueryParams(keys = "validating", values = "false")
|
@QueryParams(keys = "validating", values = "false")
|
||||||
VirtualMachine createOrUpdate(@PathParam("vmname") String vmname,
|
VirtualMachine createOrUpdate(@PathParam("vmname") String vmname, @PayloadParam("location") String location,
|
||||||
@PayloadParam("location") String location,
|
@PayloadParam("properties") VirtualMachineProperties properties,
|
||||||
@PayloadParam("properties") VirtualMachineProperties properties,
|
@PayloadParam("tags") Map<String, String> tags, @Nullable @PayloadParam("plan") Plan plan);
|
||||||
@PayloadParam("tags") Map<String, String> tags,
|
|
||||||
@Nullable @PayloadParam("plan") Plan plan);
|
|
||||||
|
|
||||||
@Named("ListVirtualMachines")
|
@Named("ListVirtualMachines")
|
||||||
@GET
|
@GET
|
||||||
|
@Path("/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines")
|
||||||
@SelectJson("value")
|
@SelectJson("value")
|
||||||
@Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
|
@Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
|
||||||
List<VirtualMachine> list();
|
List<VirtualMachine> list();
|
||||||
|
|
||||||
|
@Named("ListVirtualMachinesAll")
|
||||||
|
@GET
|
||||||
|
@Path("/providers/Microsoft.Compute/virtualMachines")
|
||||||
|
@SelectJson("value")
|
||||||
|
@Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
|
||||||
|
List<VirtualMachine> listAll();
|
||||||
|
|
||||||
|
@Named("ListVirtualMachinesByLocation")
|
||||||
|
@GET
|
||||||
|
@Path("/providers/Microsoft.Compute/locations/{location}/virtualMachines")
|
||||||
|
@SelectJson("value")
|
||||||
|
@Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
|
||||||
|
List<VirtualMachine> listByLocation(@PathParam("location") String location);
|
||||||
|
|
||||||
@Named("ListAvailableSizes")
|
@Named("ListAvailableSizes")
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("value")
|
@SelectJson("value")
|
||||||
@Path("/{name}/vmSizes")
|
@Path("/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{name}/vmSizes")
|
||||||
@Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
|
@Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
|
||||||
List<VMSize> listAvailableSizes(@PathParam("name") String name);
|
List<VMSize> listAvailableSizes(@PathParam("name") String name);
|
||||||
|
|
||||||
@Named("DeleteVirtualMachine")
|
@Named("DeleteVirtualMachine")
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("/{name}")
|
@Path("/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{name}")
|
||||||
@ResponseParser(URIParser.class)
|
@ResponseParser(URIParser.class)
|
||||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||||
URI delete(@PathParam("name") String name);
|
URI delete(@PathParam("name") String name);
|
||||||
|
|
||||||
@Named("RestartVirtualMachine")
|
@Named("RestartVirtualMachine")
|
||||||
@POST
|
@POST
|
||||||
@Path("/{name}/restart")
|
@Path("/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{name}/restart")
|
||||||
void restart(@PathParam("name") String name);
|
void restart(@PathParam("name") String name);
|
||||||
|
|
||||||
@Named("StartVirtualMachine")
|
@Named("StartVirtualMachine")
|
||||||
@POST
|
@POST
|
||||||
@Path("/{name}/start")
|
@Path("/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{name}/start")
|
||||||
void start(@PathParam("name") String name);
|
void start(@PathParam("name") String name);
|
||||||
|
|
||||||
@Named("StopVirtualMachine")
|
@Named("StopVirtualMachine")
|
||||||
@POST
|
@POST
|
||||||
@Path("/{name}/powerOff")
|
@Path("/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{name}/powerOff")
|
||||||
void stop(@PathParam("name") String name);
|
void stop(@PathParam("name") String name);
|
||||||
|
|
||||||
@Named("DeallocateVirtualMachine")
|
@Named("DeallocateVirtualMachine")
|
||||||
@POST
|
@POST
|
||||||
@Path("/{name}/deallocate")
|
@Path("/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{name}/deallocate")
|
||||||
void deallocate(@PathParam("name") String name);
|
void deallocate(@PathParam("name") String name);
|
||||||
|
|
||||||
@Named("generalize")
|
@Named("generalize")
|
||||||
@POST
|
@POST
|
||||||
@Path("/{name}/generalize")
|
@Path("/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{name}/generalize")
|
||||||
void generalize(@PathParam("name") String name);
|
void generalize(@PathParam("name") String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -140,13 +152,12 @@ public interface VirtualMachineApi {
|
|||||||
@Named("capture")
|
@Named("capture")
|
||||||
@POST
|
@POST
|
||||||
@Payload("%7B\"vhdPrefix\":\"{vhdPrefix}\",\"destinationContainerName\":\"{destinationContainerName}\",\"overwriteVhds\":\"true\"%7D")
|
@Payload("%7B\"vhdPrefix\":\"{vhdPrefix}\",\"destinationContainerName\":\"{destinationContainerName}\",\"overwriteVhds\":\"true\"%7D")
|
||||||
@Path("/{name}/capture")
|
@Path("/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{name}/capture")
|
||||||
@ResponseParser(URIParser.class)
|
@ResponseParser(URIParser.class)
|
||||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
URI capture(@PathParam("name") String name,
|
URI capture(@PathParam("name") String name, @PayloadParam("vhdPrefix") String vhdPrefix,
|
||||||
@PayloadParam("vhdPrefix") String vhdPrefix,
|
@PayloadParam("destinationContainerName") String destinationContainerName);
|
||||||
@PayloadParam("destinationContainerName") String destinationContainerName);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,16 +16,23 @@
|
|||||||
*/
|
*/
|
||||||
package org.jclouds.azurecompute.arm.compute;
|
package org.jclouds.azurecompute.arm.compute;
|
||||||
|
|
||||||
|
import static com.google.common.collect.ImmutableSet.copyOf;
|
||||||
|
import static com.google.common.collect.Iterables.transform;
|
||||||
import static org.jclouds.azurecompute.arm.compute.options.AzureTemplateOptions.Builder.resourceGroup;
|
import static org.jclouds.azurecompute.arm.compute.options.AzureTemplateOptions.Builder.resourceGroup;
|
||||||
import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.TIMEOUT_RESOURCE_DELETED;
|
import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.TIMEOUT_RESOURCE_DELETED;
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
import static org.testng.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.azurecompute.arm.AzureComputeApi;
|
import org.jclouds.azurecompute.arm.AzureComputeApi;
|
||||||
import org.jclouds.azurecompute.arm.AzureComputeProviderMetadata;
|
import org.jclouds.azurecompute.arm.AzureComputeProviderMetadata;
|
||||||
import org.jclouds.azurecompute.arm.internal.AzureLiveTestUtils;
|
import org.jclouds.azurecompute.arm.internal.AzureLiveTestUtils;
|
||||||
|
import org.jclouds.compute.domain.ComputeMetadata;
|
||||||
|
import org.jclouds.compute.domain.ComputeType;
|
||||||
|
import org.jclouds.compute.domain.NodeMetadata;
|
||||||
import org.jclouds.compute.domain.Template;
|
import org.jclouds.compute.domain.Template;
|
||||||
import org.jclouds.compute.domain.TemplateBuilder;
|
import org.jclouds.compute.domain.TemplateBuilder;
|
||||||
import org.jclouds.compute.internal.BaseComputeServiceLiveTest;
|
import org.jclouds.compute.internal.BaseComputeServiceLiveTest;
|
||||||
@ -40,6 +47,7 @@ import org.jclouds.sshj.config.SshjSshClientModule;
|
|||||||
import org.testng.annotations.AfterClass;
|
import org.testng.annotations.AfterClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.inject.Key;
|
import com.google.inject.Key;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
@ -67,6 +75,32 @@ public class AzureComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
|||||||
}, Names.named(TIMEOUT_RESOURCE_DELETED)));
|
}, Names.named(TIMEOUT_RESOURCE_DELETED)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Base method performs Iterables.elementsEqual which is case sensitive.
|
||||||
|
// Azure API can return values in different cases so we'll perform a custom validation
|
||||||
|
@Override
|
||||||
|
@Test(dependsOnMethods = "testSuspendResume")
|
||||||
|
public void testListNodesByIds() {
|
||||||
|
final Set<String> nodeIds = copyOf(transform(nodes, new Function<NodeMetadata, String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String apply(NodeMetadata from) {
|
||||||
|
return from.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
}));
|
||||||
|
|
||||||
|
final Set<? extends ComputeMetadata> listedNodes = client.listNodesByIds(nodeIds);
|
||||||
|
|
||||||
|
assertEquals(listedNodes.size(), nodes.size());
|
||||||
|
|
||||||
|
for (ComputeMetadata listedNode : listedNodes) {
|
||||||
|
assert listedNode.getProviderId() != null : listedNode;
|
||||||
|
assert listedNode.getLocation() != null : listedNode;
|
||||||
|
assertEquals(listedNode.getType(), ComputeType.NODE);
|
||||||
|
assert nodeIds.contains(listedNode.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@AfterClass(groups = "live", alwaysRun = true)
|
@AfterClass(groups = "live", alwaysRun = true)
|
||||||
protected void tearDownContext() {
|
protected void tearDownContext() {
|
||||||
|
@ -193,6 +193,41 @@ public class VirtualMachineApiLiveTest extends BaseAzureComputeApiLiveTest {
|
|||||||
assertTrue(vmPresent);
|
assertTrue(vmPresent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(dependsOnMethods = "testCreate")
|
||||||
|
public void testListAll() {
|
||||||
|
List<VirtualMachine> list = api.getVirtualMachineApi(null).listAll();
|
||||||
|
final VirtualMachine vm = api().get(vmName);
|
||||||
|
|
||||||
|
boolean vmPresent = Iterables.any(list, new Predicate<VirtualMachine>() {
|
||||||
|
public boolean apply(VirtualMachine input) {
|
||||||
|
return input.name().equals(vm.name());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
assertTrue(vmPresent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(dependsOnMethods = "testCreate")
|
||||||
|
public void testListByLocation() {
|
||||||
|
List<VirtualMachine> list = api.getVirtualMachineApi(null).listByLocation(LOCATION);
|
||||||
|
final VirtualMachine vm = api().get(vmName);
|
||||||
|
|
||||||
|
boolean vmPresent = Iterables.any(list, new Predicate<VirtualMachine>() {
|
||||||
|
public boolean apply(VirtualMachine input) {
|
||||||
|
return input.name().equals(vm.name());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
assertTrue(vmPresent);
|
||||||
|
|
||||||
|
boolean vmsInOtherLocations = Iterables.any(list, new Predicate<VirtualMachine>() {
|
||||||
|
public boolean apply(VirtualMachine input) {
|
||||||
|
return !input.location().equals(LOCATION);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
assertFalse(vmsInOtherLocations);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreate")
|
@Test(dependsOnMethods = "testCreate")
|
||||||
public void testListAvailableSizes() {
|
public void testListAvailableSizes() {
|
||||||
List<VMSize> vmSizes = api().listAvailableSizes(vmName);
|
List<VMSize> vmSizes = api().listAvailableSizes(vmName);
|
||||||
|
@ -104,7 +104,7 @@ public class VirtualMachineApiMockTest extends BaseAzureComputeApiMockTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testList() throws Exception {
|
public void testList() throws Exception {
|
||||||
server.enqueue(jsonResponse("/virtualmachines.json"));
|
server.enqueue(jsonResponse("/virtualmachinesinresourcegroup.json"));
|
||||||
final VirtualMachineApi vmAPI = api.getVirtualMachineApi("groupname");
|
final VirtualMachineApi vmAPI = api.getVirtualMachineApi("groupname");
|
||||||
assertEquals(vmAPI.list(), getVMList());
|
assertEquals(vmAPI.list(), getVMList());
|
||||||
assertSent(server, "GET", "/subscriptions/SUBSCRIPTIONID/resourceGroups/groupname/providers/Microsoft.Compute"
|
assertSent(server, "GET", "/subscriptions/SUBSCRIPTIONID/resourceGroups/groupname/providers/Microsoft.Compute"
|
||||||
@ -119,6 +119,22 @@ public class VirtualMachineApiMockTest extends BaseAzureComputeApiMockTest {
|
|||||||
+ "/virtualMachines?api-version=2018-06-01");
|
+ "/virtualMachines?api-version=2018-06-01");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testListAll() throws Exception {
|
||||||
|
server.enqueue(jsonResponse("/virtualmachinesinsubscription.json"));
|
||||||
|
final VirtualMachineApi vmAPI = api.getVirtualMachineApi(null);
|
||||||
|
assertEquals(vmAPI.listAll(), getVMListAll());
|
||||||
|
assertSent(server, "GET",
|
||||||
|
"/subscriptions/SUBSCRIPTIONID/providers/Microsoft.Compute/virtualMachines?api-version=2018-06-01");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testListByLocation() throws Exception {
|
||||||
|
server.enqueue(jsonResponse("/virtualmachinesinlocation.json"));
|
||||||
|
final VirtualMachineApi vmAPI = api.getVirtualMachineApi(null);
|
||||||
|
assertEquals(vmAPI.listByLocation("testlocation"), getVMListByLocation()); // TODO bylocation
|
||||||
|
assertSent(server, "GET", "/subscriptions/SUBSCRIPTIONID/providers/Microsoft.Compute/locations/testlocation"
|
||||||
|
+ "/virtualMachines?api-version=2018-06-01");
|
||||||
|
}
|
||||||
|
|
||||||
public void testListAvailableSizes() throws Exception {
|
public void testListAvailableSizes() throws Exception {
|
||||||
server.enqueue(jsonResponse("/virtualmachineavailablesizes.json"));
|
server.enqueue(jsonResponse("/virtualmachineavailablesizes.json"));
|
||||||
final VirtualMachineApi vmAPI = api.getVirtualMachineApi("groupname");
|
final VirtualMachineApi vmAPI = api.getVirtualMachineApi("groupname");
|
||||||
@ -429,4 +445,51 @@ public class VirtualMachineApiMockTest extends BaseAzureComputeApiMockTest {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<VirtualMachine> getVMListAll() {
|
||||||
|
List<VirtualMachine> list = new ArrayList<VirtualMachine>();
|
||||||
|
VirtualMachineProperties propertiesWithManagedDisks = getVMWithManagedDisksProperties();
|
||||||
|
VirtualMachine machineWithManagedDisks = VirtualMachine.create("/subscriptions/SUBSCRIPTIONID/" + ""
|
||||||
|
+ "resourceGroups/groupname/providers/Microsoft.Compute/virtualMachines/windowsmachine",
|
||||||
|
"windowsmachine",
|
||||||
|
"Microsoft.Compute/virtualMachines", "westus", null, propertiesWithManagedDisks, null);
|
||||||
|
list.add(machineWithManagedDisks);
|
||||||
|
VirtualMachineProperties propertiesWithBlobDisks = getVMWithBlobDisksProperties();
|
||||||
|
VirtualMachine machineWithBlobDisks = VirtualMachine.create("/subscriptions/SUBSCRIPTIONID/" + ""
|
||||||
|
+ "resourceGroups/groupname/providers/Microsoft.Compute/virtualMachines/windowsmachine",
|
||||||
|
"windowsmachine",
|
||||||
|
"Microsoft.Compute/virtualMachines", "westus", null, propertiesWithBlobDisks, null);
|
||||||
|
list.add(machineWithBlobDisks);
|
||||||
|
VirtualMachine machineInDifferentResourceGroup = VirtualMachine.create("/subscriptions/SUBSCRIPTIONID/" + ""
|
||||||
|
+ "resourceGroups/otherresourcegroup/providers/Microsoft.Compute/virtualMachines/windowsmachine",
|
||||||
|
"windowsmachine", "Microsoft.Compute/virtualMachines", "westus", null, propertiesWithBlobDisks, null);
|
||||||
|
list.add(machineInDifferentResourceGroup);
|
||||||
|
VirtualMachine machineInDifferentLocation = VirtualMachine.create("/subscriptions/SUBSCRIPTIONID/" + ""
|
||||||
|
+ "resourceGroups/groupname/providers/Microsoft.Compute/virtualMachines/windowsmachine",
|
||||||
|
"windowsmachine",
|
||||||
|
"Microsoft.Compute/virtualMachines", "eastus", null, propertiesWithBlobDisks, null);
|
||||||
|
list.add(machineInDifferentLocation);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<VirtualMachine> getVMListByLocation() {
|
||||||
|
List<VirtualMachine> list = new ArrayList<VirtualMachine>();
|
||||||
|
VirtualMachineProperties propertiesWithManagedDisks = getVMWithManagedDisksProperties();
|
||||||
|
VirtualMachine machineWithManagedDisks = VirtualMachine.create("/subscriptions/SUBSCRIPTIONID/" + ""
|
||||||
|
+ "resourceGroups/groupname/providers/Microsoft.Compute/virtualMachines/windowsmachine",
|
||||||
|
"windowsmachine",
|
||||||
|
"Microsoft.Compute/virtualMachines", "westus", null, propertiesWithManagedDisks, null);
|
||||||
|
list.add(machineWithManagedDisks);
|
||||||
|
VirtualMachineProperties propertiesWithBlobDisks = getVMWithBlobDisksProperties();
|
||||||
|
VirtualMachine machineWithBlobDisks = VirtualMachine.create("/subscriptions/SUBSCRIPTIONID/" + ""
|
||||||
|
+ "resourceGroups/groupname/providers/Microsoft.Compute/virtualMachines/windowsmachine",
|
||||||
|
"windowsmachine",
|
||||||
|
"Microsoft.Compute/virtualMachines", "westus", null, propertiesWithBlobDisks, null);
|
||||||
|
list.add(machineWithBlobDisks);
|
||||||
|
VirtualMachine machineInDifferentResourceGroup = VirtualMachine.create("/subscriptions/SUBSCRIPTIONID/" + ""
|
||||||
|
+ "resourceGroups/otherresourcegroup/providers/Microsoft.Compute/virtualMachines/windowsmachine",
|
||||||
|
"windowsmachine", "Microsoft.Compute/virtualMachines", "westus", null, propertiesWithBlobDisks, null);
|
||||||
|
list.add(machineInDifferentResourceGroup);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,303 @@
|
|||||||
|
{
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"vmId": "27ee085b-d707-xxxx-yyyy-2370e2eb1cc1",
|
||||||
|
"licenseType": "Windows_Server",
|
||||||
|
"availabilitySet":{
|
||||||
|
"id":"/subscriptions/SUBSCRIPTIONID/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/myAVSet"
|
||||||
|
},
|
||||||
|
"hardwareProfile": {
|
||||||
|
"vmSize": "Standard_D1"
|
||||||
|
},
|
||||||
|
"storageProfile": {
|
||||||
|
"imageReference": {
|
||||||
|
"publisher": "publisher",
|
||||||
|
"offer": "OFFER",
|
||||||
|
"sku": "sku",
|
||||||
|
"version": "ver",
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/providers/Microsoft.Compute/locations/westus/publishers/MicrosoftWindowsServerEssentials/artifactype/vmimage/offers/OFFER/skus/OFFER/versions/latest"
|
||||||
|
},
|
||||||
|
"osDisk": {
|
||||||
|
"osType": "Windows",
|
||||||
|
"name": "windowsmachine",
|
||||||
|
"createOption": "FromImage",
|
||||||
|
"managedDisk": {
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/osDisk",
|
||||||
|
"storageAccountType": "Standard_LRS"
|
||||||
|
},
|
||||||
|
"caching": "ReadWrite"
|
||||||
|
},
|
||||||
|
"dataDisks":[
|
||||||
|
{
|
||||||
|
"name":"mydatadisk1",
|
||||||
|
"diskSizeGB":"1",
|
||||||
|
"lun": 0,
|
||||||
|
"createOption":"Empty",
|
||||||
|
"caching":"ReadWrite",
|
||||||
|
"managedDisk": {
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/osDisk",
|
||||||
|
"storageAccountType": "Standard_LRS"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"osProfile": {
|
||||||
|
"computerName": "windowsmachine",
|
||||||
|
"adminUsername": "azureuser",
|
||||||
|
"adminPassword":"password",
|
||||||
|
"customData":"",
|
||||||
|
"windowsConfiguration": {
|
||||||
|
"provisionVMAgent": false,
|
||||||
|
"enableAutomaticUpdates": true,
|
||||||
|
"winRM": {
|
||||||
|
"listeners":[{
|
||||||
|
"protocol": "https",
|
||||||
|
"certificateUrl": "url-to-certificate"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
"additionalUnattendContent":[
|
||||||
|
{
|
||||||
|
"passName":"oobesystem",
|
||||||
|
"componentName":"Microsoft-Windows-Shell-Setup",
|
||||||
|
"settingName":"FirstLogonCommands",
|
||||||
|
"content":"<XML unattend content>"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"secrets":[
|
||||||
|
{
|
||||||
|
"sourceVault": {
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/myresourcegroup1/providers/Microsoft.KeyVault/vaults/myvault1"
|
||||||
|
},
|
||||||
|
"vaultCertificates": [
|
||||||
|
{
|
||||||
|
"certificateUrl": "https://myvault1.vault.azure.net/secrets/SECRETNAME/SECRETVERSION",
|
||||||
|
"certificateStore": "CERTIFICATESTORENAME"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"networkProfile": {
|
||||||
|
"networkInterfaces": [
|
||||||
|
{
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/groupname/providers/Microsoft.Network/networkInterfaces/windowsmachine167"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"diagnosticsProfile": {
|
||||||
|
"bootDiagnostics": {
|
||||||
|
"enabled": true,
|
||||||
|
"storageUri": "https://groupname2760.blob.core.windows.net/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"provisioningState": "Creating"
|
||||||
|
},
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/groupname/providers/Microsoft.Compute/virtualMachines/windowsmachine",
|
||||||
|
"name": "windowsmachine",
|
||||||
|
"type": "Microsoft.Compute/virtualMachines",
|
||||||
|
"location": "westus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"vmId": "27ee085b-d707-xxxx-yyyy-2370e2eb1cc1",
|
||||||
|
"licenseType": "Windows_Server",
|
||||||
|
"availabilitySet":{
|
||||||
|
"id":"/subscriptions/SUBSCRIPTIONID/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/myAVSet"
|
||||||
|
},
|
||||||
|
"hardwareProfile": {
|
||||||
|
"vmSize": "Standard_D1"
|
||||||
|
},
|
||||||
|
"storageProfile": {
|
||||||
|
"imageReference": {
|
||||||
|
"publisher": "publisher",
|
||||||
|
"offer": "OFFER",
|
||||||
|
"sku": "sku",
|
||||||
|
"version": "ver",
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/providers/Microsoft.Compute/locations/westus/publishers/MicrosoftWindowsServerEssentials/artifactype/vmimage/offers/OFFER/skus/OFFER/versions/latest"
|
||||||
|
},
|
||||||
|
"osDisk": {
|
||||||
|
"osType": "Windows",
|
||||||
|
"name": "windowsmachine",
|
||||||
|
"createOption": "FromImage",
|
||||||
|
"managedDisk": {
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/osDisk",
|
||||||
|
"storageAccountType": "Standard_LRS"
|
||||||
|
},
|
||||||
|
"vhd": {
|
||||||
|
"uri": "https://groupname2760.blob.core.windows.net/vhds/windowsmachine201624102936.vhd"
|
||||||
|
},
|
||||||
|
"caching": "ReadWrite"
|
||||||
|
},
|
||||||
|
"dataDisks":[
|
||||||
|
{
|
||||||
|
"name":"mydatadisk1",
|
||||||
|
"diskSizeGB":"1",
|
||||||
|
"lun": 0,
|
||||||
|
"vhd": {
|
||||||
|
"uri" : "http://mystorage1.blob.core.windows.net/vhds/mydatadisk1.vhd"
|
||||||
|
},
|
||||||
|
"createOption":"Empty"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"osProfile": {
|
||||||
|
"computerName": "windowsmachine",
|
||||||
|
"adminUsername": "azureuser",
|
||||||
|
"adminPassword":"password",
|
||||||
|
"customData":"",
|
||||||
|
"windowsConfiguration": {
|
||||||
|
"provisionVMAgent": false,
|
||||||
|
"enableAutomaticUpdates": true,
|
||||||
|
"winRM": {
|
||||||
|
"listeners":[{
|
||||||
|
"protocol": "https",
|
||||||
|
"certificateUrl": "url-to-certificate"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
"additionalUnattendContent":[
|
||||||
|
{
|
||||||
|
"passName":"oobesystem",
|
||||||
|
"componentName":"Microsoft-Windows-Shell-Setup",
|
||||||
|
"settingName":"FirstLogonCommands",
|
||||||
|
"content":"<XML unattend content>"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"secrets":[
|
||||||
|
{
|
||||||
|
"sourceVault": {
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/myresourcegroup1/providers/Microsoft.KeyVault/vaults/myvault1"
|
||||||
|
},
|
||||||
|
"vaultCertificates": [
|
||||||
|
{
|
||||||
|
"certificateUrl": "https://myvault1.vault.azure.net/secrets/SECRETNAME/SECRETVERSION",
|
||||||
|
"certificateStore": "CERTIFICATESTORENAME"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"networkProfile": {
|
||||||
|
"networkInterfaces": [
|
||||||
|
{
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/groupname/providers/Microsoft.Network/networkInterfaces/windowsmachine167"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"diagnosticsProfile": {
|
||||||
|
"bootDiagnostics": {
|
||||||
|
"enabled": true,
|
||||||
|
"storageUri": "https://groupname2760.blob.core.windows.net/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"provisioningState": "Creating"
|
||||||
|
},
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/groupname/providers/Microsoft.Compute/virtualMachines/windowsmachine",
|
||||||
|
"name": "windowsmachine",
|
||||||
|
"type": "Microsoft.Compute/virtualMachines",
|
||||||
|
"location": "westus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"vmId": "27ee085b-d707-xxxx-yyyy-2370e2eb1cc1",
|
||||||
|
"licenseType": "Windows_Server",
|
||||||
|
"availabilitySet":{
|
||||||
|
"id":"/subscriptions/SUBSCRIPTIONID/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/myAVSet"
|
||||||
|
},
|
||||||
|
"hardwareProfile": {
|
||||||
|
"vmSize": "Standard_D1"
|
||||||
|
},
|
||||||
|
"storageProfile": {
|
||||||
|
"imageReference": {
|
||||||
|
"publisher": "publisher",
|
||||||
|
"offer": "OFFER",
|
||||||
|
"sku": "sku",
|
||||||
|
"version": "ver",
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/providers/Microsoft.Compute/locations/westus/publishers/MicrosoftWindowsServerEssentials/artifactype/vmimage/offers/OFFER/skus/OFFER/versions/latest"
|
||||||
|
},
|
||||||
|
"osDisk": {
|
||||||
|
"osType": "Windows",
|
||||||
|
"name": "windowsmachine",
|
||||||
|
"createOption": "FromImage",
|
||||||
|
"managedDisk": {
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/osDisk",
|
||||||
|
"storageAccountType": "Standard_LRS"
|
||||||
|
},
|
||||||
|
"vhd": {
|
||||||
|
"uri": "https://groupname2760.blob.core.windows.net/vhds/windowsmachine201624102936.vhd"
|
||||||
|
},
|
||||||
|
"caching": "ReadWrite"
|
||||||
|
},
|
||||||
|
"dataDisks":[
|
||||||
|
{
|
||||||
|
"name":"mydatadisk1",
|
||||||
|
"diskSizeGB":"1",
|
||||||
|
"lun": 0,
|
||||||
|
"vhd": {
|
||||||
|
"uri" : "http://mystorage1.blob.core.windows.net/vhds/mydatadisk1.vhd"
|
||||||
|
},
|
||||||
|
"createOption":"Empty"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"osProfile": {
|
||||||
|
"computerName": "windowsmachine",
|
||||||
|
"adminUsername": "azureuser",
|
||||||
|
"adminPassword":"password",
|
||||||
|
"customData":"",
|
||||||
|
"windowsConfiguration": {
|
||||||
|
"provisionVMAgent": false,
|
||||||
|
"enableAutomaticUpdates": true,
|
||||||
|
"winRM": {
|
||||||
|
"listeners":[{
|
||||||
|
"protocol": "https",
|
||||||
|
"certificateUrl": "url-to-certificate"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
"additionalUnattendContent":[
|
||||||
|
{
|
||||||
|
"passName":"oobesystem",
|
||||||
|
"componentName":"Microsoft-Windows-Shell-Setup",
|
||||||
|
"settingName":"FirstLogonCommands",
|
||||||
|
"content":"<XML unattend content>"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"secrets":[
|
||||||
|
{
|
||||||
|
"sourceVault": {
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/myresourcegroup1/providers/Microsoft.KeyVault/vaults/myvault1"
|
||||||
|
},
|
||||||
|
"vaultCertificates": [
|
||||||
|
{
|
||||||
|
"certificateUrl": "https://myvault1.vault.azure.net/secrets/SECRETNAME/SECRETVERSION",
|
||||||
|
"certificateStore": "CERTIFICATESTORENAME"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"networkProfile": {
|
||||||
|
"networkInterfaces": [
|
||||||
|
{
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/groupname/providers/Microsoft.Network/networkInterfaces/windowsmachine167"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"diagnosticsProfile": {
|
||||||
|
"bootDiagnostics": {
|
||||||
|
"enabled": true,
|
||||||
|
"storageUri": "https://groupname2760.blob.core.windows.net/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"provisioningState": "Creating"
|
||||||
|
},
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/otherresourcegroup/providers/Microsoft.Compute/virtualMachines/windowsmachine",
|
||||||
|
"name": "windowsmachine",
|
||||||
|
"type": "Microsoft.Compute/virtualMachines",
|
||||||
|
"location": "westus"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,411 @@
|
|||||||
|
{
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"vmId": "27ee085b-d707-xxxx-yyyy-2370e2eb1cc1",
|
||||||
|
"licenseType": "Windows_Server",
|
||||||
|
"availabilitySet": {
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/myAVSet"
|
||||||
|
},
|
||||||
|
"hardwareProfile": {
|
||||||
|
"vmSize": "Standard_D1"
|
||||||
|
},
|
||||||
|
"storageProfile": {
|
||||||
|
"imageReference": {
|
||||||
|
"publisher": "publisher",
|
||||||
|
"offer": "OFFER",
|
||||||
|
"sku": "sku",
|
||||||
|
"version": "ver",
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/providers/Microsoft.Compute/locations/westus/publishers/MicrosoftWindowsServerEssentials/artifactype/vmimage/offers/OFFER/skus/OFFER/versions/latest"
|
||||||
|
},
|
||||||
|
"osDisk": {
|
||||||
|
"osType": "Windows",
|
||||||
|
"name": "windowsmachine",
|
||||||
|
"createOption": "FromImage",
|
||||||
|
"managedDisk": {
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/osDisk",
|
||||||
|
"storageAccountType": "Standard_LRS"
|
||||||
|
},
|
||||||
|
"caching": "ReadWrite"
|
||||||
|
},
|
||||||
|
"dataDisks": [
|
||||||
|
{
|
||||||
|
"name": "mydatadisk1",
|
||||||
|
"diskSizeGB": "1",
|
||||||
|
"lun": 0,
|
||||||
|
"createOption": "Empty",
|
||||||
|
"caching": "ReadWrite",
|
||||||
|
"managedDisk": {
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/osDisk",
|
||||||
|
"storageAccountType": "Standard_LRS"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"osProfile": {
|
||||||
|
"computerName": "windowsmachine",
|
||||||
|
"adminUsername": "azureuser",
|
||||||
|
"adminPassword": "password",
|
||||||
|
"customData": "",
|
||||||
|
"windowsConfiguration": {
|
||||||
|
"provisionVMAgent": false,
|
||||||
|
"enableAutomaticUpdates": true,
|
||||||
|
"winRM": {
|
||||||
|
"listeners": [
|
||||||
|
{
|
||||||
|
"protocol": "https",
|
||||||
|
"certificateUrl": "url-to-certificate"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"additionalUnattendContent": [
|
||||||
|
{
|
||||||
|
"passName": "oobesystem",
|
||||||
|
"componentName": "Microsoft-Windows-Shell-Setup",
|
||||||
|
"settingName": "FirstLogonCommands",
|
||||||
|
"content": "<XML unattend content>"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"secrets": [
|
||||||
|
{
|
||||||
|
"sourceVault": {
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/myresourcegroup1/providers/Microsoft.KeyVault/vaults/myvault1"
|
||||||
|
},
|
||||||
|
"vaultCertificates": [
|
||||||
|
{
|
||||||
|
"certificateUrl": "https://myvault1.vault.azure.net/secrets/SECRETNAME/SECRETVERSION",
|
||||||
|
"certificateStore": "CERTIFICATESTORENAME"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"networkProfile": {
|
||||||
|
"networkInterfaces": [
|
||||||
|
{
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/groupname/providers/Microsoft.Network/networkInterfaces/windowsmachine167"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"diagnosticsProfile": {
|
||||||
|
"bootDiagnostics": {
|
||||||
|
"enabled": true,
|
||||||
|
"storageUri": "https://groupname2760.blob.core.windows.net/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"provisioningState": "Creating"
|
||||||
|
},
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/groupname/providers/Microsoft.Compute/virtualMachines/windowsmachine",
|
||||||
|
"name": "windowsmachine",
|
||||||
|
"type": "Microsoft.Compute/virtualMachines",
|
||||||
|
"location": "westus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"vmId": "27ee085b-d707-xxxx-yyyy-2370e2eb1cc1",
|
||||||
|
"licenseType": "Windows_Server",
|
||||||
|
"availabilitySet": {
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/myAVSet"
|
||||||
|
},
|
||||||
|
"hardwareProfile": {
|
||||||
|
"vmSize": "Standard_D1"
|
||||||
|
},
|
||||||
|
"storageProfile": {
|
||||||
|
"imageReference": {
|
||||||
|
"publisher": "publisher",
|
||||||
|
"offer": "OFFER",
|
||||||
|
"sku": "sku",
|
||||||
|
"version": "ver",
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/providers/Microsoft.Compute/locations/westus/publishers/MicrosoftWindowsServerEssentials/artifactype/vmimage/offers/OFFER/skus/OFFER/versions/latest"
|
||||||
|
},
|
||||||
|
"osDisk": {
|
||||||
|
"osType": "Windows",
|
||||||
|
"name": "windowsmachine",
|
||||||
|
"createOption": "FromImage",
|
||||||
|
"managedDisk": {
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/osDisk",
|
||||||
|
"storageAccountType": "Standard_LRS"
|
||||||
|
},
|
||||||
|
"vhd": {
|
||||||
|
"uri": "https://groupname2760.blob.core.windows.net/vhds/windowsmachine201624102936.vhd"
|
||||||
|
},
|
||||||
|
"caching": "ReadWrite"
|
||||||
|
},
|
||||||
|
"dataDisks": [
|
||||||
|
{
|
||||||
|
"name": "mydatadisk1",
|
||||||
|
"diskSizeGB": "1",
|
||||||
|
"lun": 0,
|
||||||
|
"vhd": {
|
||||||
|
"uri": "http://mystorage1.blob.core.windows.net/vhds/mydatadisk1.vhd"
|
||||||
|
},
|
||||||
|
"createOption": "Empty"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"osProfile": {
|
||||||
|
"computerName": "windowsmachine",
|
||||||
|
"adminUsername": "azureuser",
|
||||||
|
"adminPassword": "password",
|
||||||
|
"customData": "",
|
||||||
|
"windowsConfiguration": {
|
||||||
|
"provisionVMAgent": false,
|
||||||
|
"enableAutomaticUpdates": true,
|
||||||
|
"winRM": {
|
||||||
|
"listeners": [
|
||||||
|
{
|
||||||
|
"protocol": "https",
|
||||||
|
"certificateUrl": "url-to-certificate"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"additionalUnattendContent": [
|
||||||
|
{
|
||||||
|
"passName": "oobesystem",
|
||||||
|
"componentName": "Microsoft-Windows-Shell-Setup",
|
||||||
|
"settingName": "FirstLogonCommands",
|
||||||
|
"content": "<XML unattend content>"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"secrets": [
|
||||||
|
{
|
||||||
|
"sourceVault": {
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/myresourcegroup1/providers/Microsoft.KeyVault/vaults/myvault1"
|
||||||
|
},
|
||||||
|
"vaultCertificates": [
|
||||||
|
{
|
||||||
|
"certificateUrl": "https://myvault1.vault.azure.net/secrets/SECRETNAME/SECRETVERSION",
|
||||||
|
"certificateStore": "CERTIFICATESTORENAME"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"networkProfile": {
|
||||||
|
"networkInterfaces": [
|
||||||
|
{
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/groupname/providers/Microsoft.Network/networkInterfaces/windowsmachine167"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"diagnosticsProfile": {
|
||||||
|
"bootDiagnostics": {
|
||||||
|
"enabled": true,
|
||||||
|
"storageUri": "https://groupname2760.blob.core.windows.net/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"provisioningState": "Creating"
|
||||||
|
},
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/groupname/providers/Microsoft.Compute/virtualMachines/windowsmachine",
|
||||||
|
"name": "windowsmachine",
|
||||||
|
"type": "Microsoft.Compute/virtualMachines",
|
||||||
|
"location": "westus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"vmId": "27ee085b-d707-xxxx-yyyy-2370e2eb1cc1",
|
||||||
|
"licenseType": "Windows_Server",
|
||||||
|
"availabilitySet": {
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/myAVSet"
|
||||||
|
},
|
||||||
|
"hardwareProfile": {
|
||||||
|
"vmSize": "Standard_D1"
|
||||||
|
},
|
||||||
|
"storageProfile": {
|
||||||
|
"imageReference": {
|
||||||
|
"publisher": "publisher",
|
||||||
|
"offer": "OFFER",
|
||||||
|
"sku": "sku",
|
||||||
|
"version": "ver",
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/providers/Microsoft.Compute/locations/westus/publishers/MicrosoftWindowsServerEssentials/artifactype/vmimage/offers/OFFER/skus/OFFER/versions/latest"
|
||||||
|
},
|
||||||
|
"osDisk": {
|
||||||
|
"osType": "Windows",
|
||||||
|
"name": "windowsmachine",
|
||||||
|
"createOption": "FromImage",
|
||||||
|
"managedDisk": {
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/osDisk",
|
||||||
|
"storageAccountType": "Standard_LRS"
|
||||||
|
},
|
||||||
|
"vhd": {
|
||||||
|
"uri": "https://groupname2760.blob.core.windows.net/vhds/windowsmachine201624102936.vhd"
|
||||||
|
},
|
||||||
|
"caching": "ReadWrite"
|
||||||
|
},
|
||||||
|
"dataDisks": [
|
||||||
|
{
|
||||||
|
"name": "mydatadisk1",
|
||||||
|
"diskSizeGB": "1",
|
||||||
|
"lun": 0,
|
||||||
|
"vhd": {
|
||||||
|
"uri": "http://mystorage1.blob.core.windows.net/vhds/mydatadisk1.vhd"
|
||||||
|
},
|
||||||
|
"createOption": "Empty"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"osProfile": {
|
||||||
|
"computerName": "windowsmachine",
|
||||||
|
"adminUsername": "azureuser",
|
||||||
|
"adminPassword": "password",
|
||||||
|
"customData": "",
|
||||||
|
"windowsConfiguration": {
|
||||||
|
"provisionVMAgent": false,
|
||||||
|
"enableAutomaticUpdates": true,
|
||||||
|
"winRM": {
|
||||||
|
"listeners": [
|
||||||
|
{
|
||||||
|
"protocol": "https",
|
||||||
|
"certificateUrl": "url-to-certificate"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"additionalUnattendContent": [
|
||||||
|
{
|
||||||
|
"passName": "oobesystem",
|
||||||
|
"componentName": "Microsoft-Windows-Shell-Setup",
|
||||||
|
"settingName": "FirstLogonCommands",
|
||||||
|
"content": "<XML unattend content>"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"secrets": [
|
||||||
|
{
|
||||||
|
"sourceVault": {
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/myresourcegroup1/providers/Microsoft.KeyVault/vaults/myvault1"
|
||||||
|
},
|
||||||
|
"vaultCertificates": [
|
||||||
|
{
|
||||||
|
"certificateUrl": "https://myvault1.vault.azure.net/secrets/SECRETNAME/SECRETVERSION",
|
||||||
|
"certificateStore": "CERTIFICATESTORENAME"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"networkProfile": {
|
||||||
|
"networkInterfaces": [
|
||||||
|
{
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/groupname/providers/Microsoft.Network/networkInterfaces/windowsmachine167"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"diagnosticsProfile": {
|
||||||
|
"bootDiagnostics": {
|
||||||
|
"enabled": true,
|
||||||
|
"storageUri": "https://groupname2760.blob.core.windows.net/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"provisioningState": "Creating"
|
||||||
|
},
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/otherresourcegroup/providers/Microsoft.Compute/virtualMachines/windowsmachine",
|
||||||
|
"name": "windowsmachine",
|
||||||
|
"type": "Microsoft.Compute/virtualMachines",
|
||||||
|
"location": "westus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"vmId": "27ee085b-d707-xxxx-yyyy-2370e2eb1cc1",
|
||||||
|
"licenseType": "Windows_Server",
|
||||||
|
"availabilitySet": {
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/myAVSet"
|
||||||
|
},
|
||||||
|
"hardwareProfile": {
|
||||||
|
"vmSize": "Standard_D1"
|
||||||
|
},
|
||||||
|
"storageProfile": {
|
||||||
|
"imageReference": {
|
||||||
|
"publisher": "publisher",
|
||||||
|
"offer": "OFFER",
|
||||||
|
"sku": "sku",
|
||||||
|
"version": "ver",
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/providers/Microsoft.Compute/locations/westus/publishers/MicrosoftWindowsServerEssentials/artifactype/vmimage/offers/OFFER/skus/OFFER/versions/latest"
|
||||||
|
},
|
||||||
|
"osDisk": {
|
||||||
|
"osType": "Windows",
|
||||||
|
"name": "windowsmachine",
|
||||||
|
"createOption": "FromImage",
|
||||||
|
"managedDisk": {
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/osDisk",
|
||||||
|
"storageAccountType": "Standard_LRS"
|
||||||
|
},
|
||||||
|
"vhd": {
|
||||||
|
"uri": "https://groupname2760.blob.core.windows.net/vhds/windowsmachine201624102936.vhd"
|
||||||
|
},
|
||||||
|
"caching": "ReadWrite"
|
||||||
|
},
|
||||||
|
"dataDisks": [
|
||||||
|
{
|
||||||
|
"name": "mydatadisk1",
|
||||||
|
"diskSizeGB": "1",
|
||||||
|
"lun": 0,
|
||||||
|
"vhd": {
|
||||||
|
"uri": "http://mystorage1.blob.core.windows.net/vhds/mydatadisk1.vhd"
|
||||||
|
},
|
||||||
|
"createOption": "Empty"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"osProfile": {
|
||||||
|
"computerName": "windowsmachine",
|
||||||
|
"adminUsername": "azureuser",
|
||||||
|
"adminPassword": "password",
|
||||||
|
"customData": "",
|
||||||
|
"windowsConfiguration": {
|
||||||
|
"provisionVMAgent": false,
|
||||||
|
"enableAutomaticUpdates": true,
|
||||||
|
"winRM": {
|
||||||
|
"listeners": [
|
||||||
|
{
|
||||||
|
"protocol": "https",
|
||||||
|
"certificateUrl": "url-to-certificate"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"additionalUnattendContent": [
|
||||||
|
{
|
||||||
|
"passName": "oobesystem",
|
||||||
|
"componentName": "Microsoft-Windows-Shell-Setup",
|
||||||
|
"settingName": "FirstLogonCommands",
|
||||||
|
"content": "<XML unattend content>"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"secrets": [
|
||||||
|
{
|
||||||
|
"sourceVault": {
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/myresourcegroup1/providers/Microsoft.KeyVault/vaults/myvault1"
|
||||||
|
},
|
||||||
|
"vaultCertificates": [
|
||||||
|
{
|
||||||
|
"certificateUrl": "https://myvault1.vault.azure.net/secrets/SECRETNAME/SECRETVERSION",
|
||||||
|
"certificateStore": "CERTIFICATESTORENAME"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"networkProfile": {
|
||||||
|
"networkInterfaces": [
|
||||||
|
{
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/groupname/providers/Microsoft.Network/networkInterfaces/windowsmachine167"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"diagnosticsProfile": {
|
||||||
|
"bootDiagnostics": {
|
||||||
|
"enabled": true,
|
||||||
|
"storageUri": "https://groupname2760.blob.core.windows.net/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"provisioningState": "Creating"
|
||||||
|
},
|
||||||
|
"id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/groupname/providers/Microsoft.Compute/virtualMachines/windowsmachine",
|
||||||
|
"name": "windowsmachine",
|
||||||
|
"type": "Microsoft.Compute/virtualMachines",
|
||||||
|
"location": "eastus"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user