diff --git a/azure/src/test/java/com/microsoft/azure/AzureTests.java b/azure/src/test/java/com/microsoft/azure/AzureTests.java index 72b14acd4889..b81fa7aaa6d7 100644 --- a/azure/src/test/java/com/microsoft/azure/AzureTests.java +++ b/azure/src/test/java/com/microsoft/azure/AzureTests.java @@ -10,9 +10,11 @@ import com.microsoft.azure.management.compute.Publisher; import com.microsoft.azure.management.compute.Sku; import com.microsoft.azure.management.compute.VirtualMachineImage; +import com.microsoft.azure.management.resources.Deployment; import com.microsoft.azure.management.resources.GenericResource; import com.microsoft.azure.management.resources.Subscriptions; import com.microsoft.azure.management.resources.fluentcore.arm.Region; +import com.microsoft.azure.management.resources.implementation.api.DeploymentMode; import com.microsoft.azure.management.storage.StorageAccount; import com.microsoft.azure.management.storage.implementation.api.SkuName; import com.microsoft.rest.credentials.ServiceClientCredentials; @@ -70,6 +72,30 @@ public void setup() throws Exception { } } + /** + * Tests ARM template deployments + * @throws IOException + * @throws CloudException + */ + @Test public void testDeployments() throws Exception { + String testId = String.valueOf(System.currentTimeMillis()); + List deployments = azure.deployments().list(); + System.out.println("Deployments: " + deployments.size()); + Deployment deployment = azure.deployments() + .define("depl" + testId) + .withNewGroup("rg" + testId, Region.US_WEST) + .withTemplateLink( + "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-vnet-two-subnets/azuredeploy.json", + "1.0.0.0") + .withParametersLink( + "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-vnet-two-subnets/azuredeploy.parameters.json", + "1.0.0.0") + .withMode(DeploymentMode.COMPLETE) + .create(); + System.out.println("Create deployment: " + deployment.correlationId()); + } + + /** * Tests basic generic resources retrieval * @throws Exception