protected static void createStorageAccount(String storageAccountName, String storageContainer) throws Exception { // String storageAccountCreateName = testStoragePrefix + randomString(10); String storageAccountLabel = storageAccountName + "Label1"; // Arrange StorageAccountCreateParameters createParameters = new StorageAccountCreateParameters(); // required createParameters.setName(storageAccountName); // required createParameters.setLabel(storageAccountLabel); // required if no affinity group has set createParameters.setLocation(vmLocation); createParameters.setAccountType("Standard_LRS"); // act OperationResponse operationResponse = storageManagementClient.getStorageAccountsOperations().create(createParameters); // Assert Assert.assertEquals(200, operationResponse.getStatusCode()); // use container inside storage account, needed for os image storage. StorageAccountGetKeysResponse storageAccountGetKeysResponse = storageManagementClient.getStorageAccountsOperations().getKeys(storageAccountName); storageAccountKey = storageAccountGetKeysResponse.getPrimaryKey(); createStorageContainer(storageAccountName, storageContainer); }
protected static void cleanStorageAccount(String storageAccountName) { OperationResponse operationResponse = null; try { operationResponse = storageManagementClient.getStorageAccountsOperations().delete(storageAccountName); } catch (IOException e) { e.printStackTrace(); } catch (ServiceException e) { e.printStackTrace(); } if (operationResponse != null) { Assert.assertEquals(200, operationResponse.getStatusCode()); } }