diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachine.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachine.java
index 95835507c3971..172428a54d2fd 100644
--- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachine.java
+++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachine.java
@@ -240,8 +240,11 @@ interface Definition extends
DefinitionStages.WithPublicIpAddress,
DefinitionStages.WithPrimaryNetworkInterface,
DefinitionStages.WithOS,
- DefinitionStages.WithRootUserName,
- DefinitionStages.WithAdminUserName,
+ DefinitionStages.WithLinuxRootUsername,
+ DefinitionStages.WithLinuxRootPasswordOrPublicKey,
+ DefinitionStages.WithWindowsAdminUsername,
+ DefinitionStages.WithWindowsAdminPassword,
+ DefinitionStages.WithFromImageCreateOptions,
DefinitionStages.WithLinuxCreate,
DefinitionStages.WithWindowsCreate,
DefinitionStages.WithCreate {
@@ -406,7 +409,7 @@ interface WithOS {
* @param knownImage enum value indicating known market-place image
* @return the next stage of the virtual machine definition
*/
- WithAdminUserName withPopularWindowsImage(KnownWindowsVirtualMachineImage knownImage);
+ WithWindowsAdminUsername withPopularWindowsImage(KnownWindowsVirtualMachineImage knownImage);
/**
* Specifies that the latest version of a marketplace Windows image needs to be used.
@@ -416,7 +419,7 @@ interface WithOS {
* @param sku specifies the SKU of the image
* @return the next stage of the virtual machine definition
*/
- WithAdminUserName withLatestWindowsImage(String publisher, String offer, String sku);
+ WithWindowsAdminUsername withLatestWindowsImage(String publisher, String offer, String sku);
/**
* Specifies the version of a marketplace Windows image needs to be used.
@@ -424,7 +427,7 @@ interface WithOS {
* @param imageReference describes publisher, offer, sku and version of the market-place image
* @return the next stage of the virtual machine definition
*/
- WithAdminUserName withSpecificWindowsImageVersion(ImageReference imageReference);
+ WithWindowsAdminUsername withSpecificWindowsImageVersion(ImageReference imageReference);
/**
* Specifies the user (generalized) Windows image used for the virtual machine's OS.
@@ -432,7 +435,7 @@ interface WithOS {
* @param imageUrl the url the the VHD
* @return the next stage of the virtual machine definition
*/
- WithAdminUserName withStoredWindowsImage(String imageUrl);
+ WithWindowsAdminUsername withStoredWindowsImage(String imageUrl);
/**
* Specifies the known marketplace Linux image used for the virtual machine's OS.
@@ -440,7 +443,7 @@ interface WithOS {
* @param knownImage enum value indicating known market-place image
* @return the next stage of the virtual machine definition
*/
- WithRootUserName withPopularLinuxImage(KnownLinuxVirtualMachineImage knownImage);
+ WithLinuxRootUsername withPopularLinuxImage(KnownLinuxVirtualMachineImage knownImage);
/**
* Specifies that the latest version of a marketplace Linux image needs to be used.
@@ -450,7 +453,7 @@ interface WithOS {
* @param sku specifies the SKU of the image
* @return the next stage of the virtual machine definition
*/
- WithRootUserName withLatestLinuxImage(String publisher, String offer, String sku);
+ WithLinuxRootUsername withLatestLinuxImage(String publisher, String offer, String sku);
/**
* Specifies the version of a market-place Linux image needs to be used.
@@ -458,7 +461,7 @@ interface WithOS {
* @param imageReference describes publisher, offer, sku and version of the market-place image
* @return the next stage of the virtual machine definition
*/
- WithRootUserName withSpecificLinuxImageVersion(ImageReference imageReference);
+ WithLinuxRootUsername withSpecificLinuxImageVersion(ImageReference imageReference);
/**
* Specifies the user (generalized) Linux image used for the virtual machine's OS.
@@ -466,7 +469,7 @@ interface WithOS {
* @param imageUrl the url the the VHD
* @return the next stage of the virtual machine definition
*/
- WithRootUserName withStoredLinuxImage(String imageUrl);
+ WithLinuxRootUsername withStoredLinuxImage(String imageUrl);
/**
* Specifies the specialized operating system disk to be attached to the virtual machine.
@@ -479,29 +482,98 @@ interface WithOS {
}
/**
- * The stage of the Linux virtual machine definition allowing to specify root user name.
+ * The stage of the Linux virtual machine definition allowing to specify SSH root user name.
*/
- interface WithRootUserName {
+ interface WithLinuxRootUsername {
/**
- * Specifies the root user name for the Linux virtual machine.
+ * Specifies the SSH root user name for the Linux virtual machine.
*
- * @param rootUserName the Linux root user name. This must follow the required naming convention for Linux user name
+ * @param rootUserName the Linux SSH root user name. This must follow the required naming convention for Linux user name
* @return the next stage of the Linux virtual machine definition
*/
- WithLinuxCreate withRootUserName(String rootUserName);
+ WithLinuxRootPasswordOrPublicKey withRootUsername(String rootUserName);
+ }
+
+ /**
+ * The stage of the Linux virtual machine definition allowing to specify SSH root password or public key.
+ */
+ interface WithLinuxRootPasswordOrPublicKey {
+ /**
+ * Specifies the SSH root password for the Linux virtual machine.
+ *
+ * @param rootPassword the SSH root password. This must follow the criteria for Azure Linux VM password.
+ * @return the next stage of the Linux virtual machine definition
+ */
+ WithLinuxCreate withRootPassword(String rootPassword);
+
+ /**
+ * Specifies the SSH public key.
+ *
+ * Each call to this method adds the given public key to the list of VM's public keys.
+ *
+ * @param publicKey the SSH public key in PEM format.
+ * @return the next stage of the Linux virtual machine definition
+ */
+ WithLinuxCreate withSsh(String publicKey);
}
/**
* The stage of the Windows virtual machine definition allowing to specify administrator user name.
*/
- interface WithAdminUserName {
+ interface WithWindowsAdminUsername {
/**
* Specifies the administrator user name for the Windows virtual machine.
*
* @param adminUserName the Windows administrator user name. This must follow the required naming convention for Windows user name.
* @return the stage representing creatable Linux VM definition
*/
- WithWindowsCreate withAdminUserName(String adminUserName);
+ WithWindowsAdminPassword withAdminUsername(String adminUserName);
+ }
+
+ /**
+ * The stage of the Windows virtual machine definition allowing to specify administrator user name.
+ */
+ interface WithWindowsAdminPassword {
+ /**
+ * Specifies the administrator password for the Windows virtual machine.
+ *
+ * @param adminPassword the administrator password. This must follow the criteria for Azure Windows VM password.
+ * @return the stage representing creatable Windows VM definition
+ */
+ WithWindowsCreate withAdminPassword(String adminPassword);
+ }
+
+ /**
+ * The stage of the virtual machine definition allowing to specify the custom data.
+ */
+ interface WithCustomData {
+ /**
+ * Specifies the custom data for the virtual machine.
+ *
+ * @param base64EncodedCustomData the base64 encoded custom data
+ * @return the stage representing creatable Windows VM definition
+ */
+ WithFromImageCreateOptions withCustomData(String base64EncodedCustomData);
+ }
+
+ /**
+ * The stage of the virtual machine definition allowing to specify the computer name.
+ */
+ interface WithComputerName {
+ /**
+ * Specifies the computer name for the virtual machine.
+ *
+ * @param computerName the computer name
+ * @return the stage representing creatable VM definition
+ */
+ WithFromImageCreateOptions withComputerName(String computerName);
+ }
+
+ /**
+ * The stages contains OS agnostics settings when virtual machine is created from image.
+ */
+ interface WithFromImageCreateOptions extends
+ WithCustomData, WithComputerName, WithCreate {
}
/**
@@ -509,7 +581,7 @@ interface WithAdminUserName {
* the resource to be created (via {@link WithCreate#create()}), but also allows
* for any other optional settings to be specified.
*/
- interface WithLinuxCreate extends WithCreate {
+ interface WithLinuxCreate extends WithFromImageCreateOptions {
/**
* Specifies the SSH public key.
*
@@ -526,14 +598,14 @@ interface WithLinuxCreate extends WithCreate {
* the resource to be created (via {@link WithCreate#create()}, but also allows
* for any other optional settings to be specified.
*/
- interface WithWindowsCreate extends WithCreate {
+ interface WithWindowsCreate extends WithFromImageCreateOptions {
/**
* Specifies that VM Agent should not be provisioned.
*
* @return the stage representing creatable Windows VM definition
*/
@Method
- WithWindowsCreate disableVmAgent();
+ WithWindowsCreate withoutVmAgent();
/**
* Specifies that automatic updates should be disabled.
@@ -541,7 +613,7 @@ interface WithWindowsCreate extends WithCreate {
* @return the stage representing creatable Windows VM definition
*/
@Method
- WithWindowsCreate disableAutoUpdate();
+ WithWindowsCreate withoutAutoUpdate();
/**
* Specifies the time-zone.
@@ -562,19 +634,6 @@ interface WithWindowsCreate extends WithCreate {
WithWindowsCreate withWinRm(WinRMListener listener);
}
- /**
- * The stage of the virtual machine definition allowing to specify password.
- */
- interface WithPassword {
- /**
- * Specifies the password for the virtual machine.
- *
- * @param password the password. This must follow the criteria for Azure VM password.
- * @return the stage representing creatable VM definition
- */
- WithCreate withPassword(String password);
- }
-
/**
* The stage of the virtual machine definition allowing to specify OS disk configurations.
*/
@@ -810,7 +869,6 @@ interface WithExtension {
interface WithCreate extends
Creatable,
Resource.DefinitionWithTags,
- DefinitionStages.WithPassword,
DefinitionStages.WithOsDiskSettings,
DefinitionStages.WithVMSize,
DefinitionStages.WithStorageAccount,
diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImpl.java
index e3c926eff3417..462c767802d5b 100644
--- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImpl.java
+++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImpl.java
@@ -421,13 +421,13 @@ public VirtualMachineImpl withOsDisk(String osDiskUrl, OperatingSystemTypes osTy
//
@Override
- public VirtualMachineImpl withRootUserName(String rootUserName) {
+ public VirtualMachineImpl withRootUsername(String rootUserName) {
this.inner().osProfile().withAdminUsername(rootUserName);
return this;
}
@Override
- public VirtualMachineImpl withAdminUserName(String adminUserName) {
+ public VirtualMachineImpl withAdminUsername(String adminUserName) {
this.inner().osProfile().withAdminUsername(adminUserName);
return this;
}
@@ -451,13 +451,13 @@ public VirtualMachineImpl withSsh(String publicKeyData) {
}
@Override
- public VirtualMachineImpl disableVmAgent() {
+ public VirtualMachineImpl withoutVmAgent() {
this.inner().osProfile().windowsConfiguration().withProvisionVMAgent(false);
return this;
}
@Override
- public VirtualMachineImpl disableAutoUpdate() {
+ public VirtualMachineImpl withoutAutoUpdate() {
this.inner().osProfile().windowsConfiguration().withEnableAutomaticUpdates(false);
return this;
}
@@ -484,11 +484,29 @@ public VirtualMachineImpl withWinRm(WinRMListener listener) {
}
@Override
- public VirtualMachineImpl withPassword(String password) {
+ public VirtualMachineImpl withRootPassword(String password) {
this.inner().osProfile().withAdminPassword(password);
return this;
}
+ @Override
+ public VirtualMachineImpl withAdminPassword(String password) {
+ this.inner().osProfile().withAdminPassword(password);
+ return this;
+ }
+
+ @Override
+ public VirtualMachineImpl withCustomData(String base64EncodedCustomData) {
+ this.inner().osProfile().withCustomData(base64EncodedCustomData);
+ return this;
+ }
+
+ @Override
+ public VirtualMachineImpl withComputerName(String computerName) {
+ this.inner().osProfile().withComputerName(computerName);
+ return this;
+ }
+
@Override
public VirtualMachineImpl withSize(String sizeName) {
this.inner().hardwareProfile().withVmSize(new VirtualMachineSizeTypes(sizeName));
@@ -625,10 +643,17 @@ public VirtualMachineImpl withNewAvailabilitySet(Creatable crea
@Override
public VirtualMachineImpl withNewAvailabilitySet(String name) {
- return withNewAvailabilitySet(super.myManager.availabilitySets().define(name)
- .withRegion(this.regionName())
- .withExistingResourceGroup(this.resourceGroupName())
- );
+ AvailabilitySet.DefinitionStages.WithGroup definitionWithGroup = super.myManager
+ .availabilitySets()
+ .define(name)
+ .withRegion(this.regionName());
+ Creatable definitionAfterGroup;
+ if (this.creatableGroup != null) {
+ definitionAfterGroup = definitionWithGroup.withNewResourceGroup(this.creatableGroup);
+ } else {
+ definitionAfterGroup = definitionWithGroup.withExistingResourceGroup(this.resourceGroupName());
+ }
+ return withNewAvailabilitySet(definitionAfterGroup);
}
@Override
@@ -732,6 +757,10 @@ public VirtualMachineImpl withoutExtension(String name) {
@Override
public String computerName() {
+ if (inner().osProfile() == null) {
+ // VM created by attaching a specialized OS Disk VHD will not have the osProfile.
+ return null;
+ }
return inner().osProfile().computerName();
}
diff --git a/azure-mgmt-compute/src/test/java/com/microsoft/azure/management/compute/VirtualMachineExtensionOperationsTests.java b/azure-mgmt-compute/src/test/java/com/microsoft/azure/management/compute/VirtualMachineExtensionOperationsTests.java
index 7d54e78723d08..568a250c917db 100644
--- a/azure-mgmt-compute/src/test/java/com/microsoft/azure/management/compute/VirtualMachineExtensionOperationsTests.java
+++ b/azure-mgmt-compute/src/test/java/com/microsoft/azure/management/compute/VirtualMachineExtensionOperationsTests.java
@@ -46,8 +46,8 @@ public void canEnableDiagnosticsExtension() throws Exception {
.withPrimaryPrivateIpAddressDynamic()
.withoutPrimaryPublicIpAddress()
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_14_04_LTS)
- .withRootUserName("Foo12")
- .withPassword("BaR@12abc!")
+ .withRootUsername("Foo12")
+ .withRootPassword("BaR@12abc!")
.withSize(VirtualMachineSizeTypes.STANDARD_D3)
.withExistingStorageAccount(storageAccount)
.create();
@@ -88,8 +88,8 @@ public void canResetPasswordUsingVMAccessExtension() throws Exception {
.withPrimaryPrivateIpAddressDynamic()
.withoutPrimaryPublicIpAddress()
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_14_04_LTS)
- .withRootUserName("Foo12")
- .withPassword("BaR@12abc!")
+ .withRootUsername("Foo12")
+ .withRootPassword("BaR@12abc!")
.withSize(VirtualMachineSizeTypes.STANDARD_D3)
.create();
@@ -142,8 +142,8 @@ public void canInstallUninstallCustomExtension() throws Exception {
.withPrimaryPrivateIpAddressDynamic()
.withoutPrimaryPublicIpAddress()
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_14_04_LTS)
- .withRootUserName("Foo12")
- .withPassword("BaR@12abc!")
+ .withRootUsername("Foo12")
+ .withRootPassword("BaR@12abc!")
.withSize(VirtualMachineSizeTypes.STANDARD_D3)
.defineNewExtension("CustomScriptForLinux")
.withPublisher("Microsoft.OSTCExtensions")
@@ -187,8 +187,8 @@ public void canHandleExtensionReference() throws Exception {
.withPrimaryPrivateIpAddressDynamic()
.withoutPrimaryPublicIpAddress()
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_14_04_LTS)
- .withRootUserName("Foo12")
- .withPassword("BaR@12abc!")
+ .withRootUsername("Foo12")
+ .withRootPassword("BaR@12abc!")
.withSize(VirtualMachineSizeTypes.STANDARD_D3)
.defineNewExtension("VMAccessForLinux")
.withPublisher("Microsoft.OSTCExtensions")
diff --git a/azure-mgmt-compute/src/test/java/com/microsoft/azure/management/compute/VirtualMachineOperationsTests.java b/azure-mgmt-compute/src/test/java/com/microsoft/azure/management/compute/VirtualMachineOperationsTests.java
index 0ea7cd8e51761..9a8ef28895ff7 100644
--- a/azure-mgmt-compute/src/test/java/com/microsoft/azure/management/compute/VirtualMachineOperationsTests.java
+++ b/azure-mgmt-compute/src/test/java/com/microsoft/azure/management/compute/VirtualMachineOperationsTests.java
@@ -32,8 +32,8 @@ public void canCreateVirtualMachine() throws Exception {
.withPrimaryPrivateIpAddressDynamic()
.withoutPrimaryPublicIpAddress()
.withPopularWindowsImage(KnownWindowsVirtualMachineImage.WINDOWS_SERVER_2012_DATACENTER)
- .withAdminUserName("Foo12")
- .withPassword("BaR@12")
+ .withAdminUsername("Foo12")
+ .withAdminPassword("BaR@12")
.withSize(VirtualMachineSizeTypes.STANDARD_D3)
.withOsDiskCaching(CachingTypes.READ_WRITE)
.withOsDiskName("javatest")
diff --git a/azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/CreateVirtualMachinesUsingCustomImageOrSpecializedVHD.java b/azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/CreateVirtualMachinesUsingCustomImageOrSpecializedVHD.java
index 6b85ec22a2a45..72f1e6506170a 100644
--- a/azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/CreateVirtualMachinesUsingCustomImageOrSpecializedVHD.java
+++ b/azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/CreateVirtualMachinesUsingCustomImageOrSpecializedVHD.java
@@ -76,8 +76,8 @@ public static void main(String[] args) {
.withPrimaryPrivateIpAddressDynamic()
.withNewPrimaryPublicIpAddress(publicIpDnsLabel)
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
- .withRootUserName(userName)
- .withPassword(password)
+ .withRootUsername(userName)
+ .withRootPassword(password)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.defineNewExtension("CustomScriptForLinux")
.withPublisher("Microsoft.OSTCExtensions")
@@ -134,8 +134,8 @@ public static void main(String[] args) {
.withPrimaryPrivateIpAddressDynamic()
.withoutPrimaryPublicIpAddress()
.withStoredLinuxImage(capturedImageUri) // Note: A Generalized Image can also be an uploaded VHD prepared from an on-premise generalized VM.
- .withRootUserName(userName)
- .withPassword(password)
+ .withRootUsername(userName)
+ .withRootPassword(password)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.create();
diff --git a/azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/ManageAvailabilitySet.java b/azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/ManageAvailabilitySet.java
index 985635a291d66..fc26792e60571 100644
--- a/azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/ManageAvailabilitySet.java
+++ b/azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/ManageAvailabilitySet.java
@@ -107,8 +107,8 @@ public static void main(String[] args) {
.withPrimaryPrivateIpAddressDynamic()
.withoutPrimaryPublicIpAddress()
.withPopularWindowsImage(KnownWindowsVirtualMachineImage.WINDOWS_SERVER_2012_R2_DATACENTER)
- .withAdminUserName(userName)
- .withPassword(password)
+ .withAdminUsername(userName)
+ .withAdminPassword(password)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.withExistingAvailabilitySet(availSet1)
.create();
@@ -130,8 +130,8 @@ public static void main(String[] args) {
.withPrimaryPrivateIpAddressDynamic()
.withoutPrimaryPublicIpAddress()
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
- .withRootUserName(userName)
- .withPassword(password)
+ .withRootUsername(userName)
+ .withRootPassword(password)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.withExistingAvailabilitySet(availSet1)
.create();
diff --git a/azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/ManageVirtualMachine.java b/azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/ManageVirtualMachine.java
index 31a284b54c26d..9ad23c51be871 100644
--- a/azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/ManageVirtualMachine.java
+++ b/azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/ManageVirtualMachine.java
@@ -84,8 +84,8 @@ public static void main(String[] args) {
.withPrimaryPrivateIpAddressDynamic()
.withoutPrimaryPublicIpAddress()
.withPopularWindowsImage(KnownWindowsVirtualMachineImage.WINDOWS_SERVER_2012_R2_DATACENTER)
- .withAdminUserName(userName)
- .withPassword(password)
+ .withAdminUsername(userName)
+ .withAdminPassword(password)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.create();
@@ -216,8 +216,8 @@ public static void main(String[] args) {
.withPrimaryPrivateIpAddressDynamic()
.withoutPrimaryPublicIpAddress()
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
- .withRootUserName(userName)
- .withPassword(password)
+ .withRootUsername(userName)
+ .withRootPassword(password)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.create();
diff --git a/azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/ManageVirtualMachineExtension.java b/azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/ManageVirtualMachineExtension.java
index bc1af57692eb9..00bd6a1fe1fbc 100644
--- a/azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/ManageVirtualMachineExtension.java
+++ b/azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/ManageVirtualMachineExtension.java
@@ -124,8 +124,8 @@ public static void main(String[] args) {
.withPrimaryPrivateIpAddressDynamic()
.withNewPrimaryPublicIpAddress(pipDnsLabelLinuxVM)
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_14_04_LTS)
- .withRootUserName(firstLinuxUserName)
- .withPassword(firstLinuxUserPassword)
+ .withRootUsername(firstLinuxUserName)
+ .withRootPassword(firstLinuxUserPassword)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.create();
@@ -222,8 +222,8 @@ public static void main(String[] args) {
.withPrimaryPrivateIpAddressDynamic()
.withNewPrimaryPublicIpAddress(pipDnsLabelWindowsVM)
.withPopularWindowsImage(KnownWindowsVirtualMachineImage.WINDOWS_SERVER_2012_R2_DATACENTER)
- .withAdminUserName(firstWindowsUserName)
- .withPassword(firstWindowsUserPassword)
+ .withAdminUsername(firstWindowsUserName)
+ .withAdminPassword(firstWindowsUserPassword)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.defineNewExtension(windowsCustomScriptExtensionName)
.withPublisher(windowsCustomScriptExtensionPublisherName)
diff --git a/azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/ManageVirtualMachinesInParallel.java b/azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/ManageVirtualMachinesInParallel.java
index 30d0ed6d69621..0e876a45aa393 100644
--- a/azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/ManageVirtualMachinesInParallel.java
+++ b/azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/ManageVirtualMachinesInParallel.java
@@ -67,14 +67,14 @@ public static void main(String[] args) {
.create();
// Prepare Creatable Network definition [Where all the virtual machines get added to]
- Network.DefinitionStages.WithCreate creatableNetwork = azure.networks()
+ Creatable creatableNetwork = azure.networks()
.define(networkName)
.withRegion(Region.US_EAST)
.withExistingResourceGroup(resourceGroup)
.withAddressSpace("172.16.0.0/16");
// Prepare Creatable Storage account definition [For storing VMs disk]
- StorageAccount.DefinitionStages.WithCreate creatableStorageAccount = azure.storageAccounts()
+ Creatable creatableStorageAccount = azure.storageAccounts()
.define(storageAccountName)
.withRegion(Region.US_EAST)
.withExistingResourceGroup(resourceGroup);
@@ -91,8 +91,8 @@ public static void main(String[] args) {
.withPrimaryPrivateIpAddressDynamic()
.withoutPrimaryPublicIpAddress()
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
- .withRootUserName(userName)
- .withPassword(password)
+ .withRootUsername(userName)
+ .withRootPassword(password)
.withSize(VirtualMachineSizeTypes.STANDARD_DS3_V2)
.withNewStorageAccount(creatableStorageAccount);
creatableVirtualMachines.add(creatableVirtualMachine);
diff --git a/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageIPAddress.java b/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageIPAddress.java
index 693e2df92d3f0..251814a7ed4e5 100644
--- a/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageIPAddress.java
+++ b/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageIPAddress.java
@@ -93,8 +93,8 @@ public static void main(String[] args) {
.withPrimaryPrivateIpAddressDynamic()
.withExistingPrimaryPublicIpAddress(publicIpAddress)
.withPopularWindowsImage(KnownWindowsVirtualMachineImage.WINDOWS_SERVER_2012_R2_DATACENTER)
- .withAdminUserName(userName)
- .withPassword(password)
+ .withAdminUsername(userName)
+ .withAdminPassword(password)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.create();
diff --git a/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageInternalLoadBalancer.java b/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageInternalLoadBalancer.java
index e57a4cfd0a075..d010bb6214102 100644
--- a/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageInternalLoadBalancer.java
+++ b/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageInternalLoadBalancer.java
@@ -303,7 +303,7 @@ public static void main(String[] args) {
.withExistingResourceGroup(rgName)
.withExistingPrimaryNetworkInterface(networkInterfaces2.get(0))
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
- .withRootUserName(userName)
+ .withRootUsername(userName)
.withSsh(sshKey)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.withExistingAvailabilitySet(availSet2);
@@ -316,7 +316,7 @@ public static void main(String[] args) {
.withExistingResourceGroup(rgName)
.withExistingPrimaryNetworkInterface(networkInterfaces2.get(1))
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
- .withRootUserName(userName)
+ .withRootUsername(userName)
.withSsh(sshKey)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.withExistingAvailabilitySet(availSet2);
diff --git a/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageInternetFacingLoadBalancer.java b/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageInternetFacingLoadBalancer.java
index e9c428eb6ac5c..7aec769e4f48e 100644
--- a/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageInternetFacingLoadBalancer.java
+++ b/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageInternetFacingLoadBalancer.java
@@ -333,7 +333,7 @@ public static void main(String[] args) {
.withExistingResourceGroup(rgName)
.withExistingPrimaryNetworkInterface(networkInterfaces1.get(0))
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
- .withRootUserName(userName)
+ .withRootUsername(userName)
.withSsh(sshKey)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.withExistingAvailabilitySet(availSet1);
@@ -346,7 +346,7 @@ public static void main(String[] args) {
.withExistingResourceGroup(rgName)
.withExistingPrimaryNetworkInterface(networkInterfaces1.get(1))
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
- .withRootUserName(userName)
+ .withRootUsername(userName)
.withSsh(sshKey)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.withExistingAvailabilitySet(availSet1);
diff --git a/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageNetworkInterface.java b/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageNetworkInterface.java
index 1bcc93708672b..e0132877514d1 100644
--- a/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageNetworkInterface.java
+++ b/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageNetworkInterface.java
@@ -149,8 +149,8 @@ public static void main(String[] args) {
.withExistingResourceGroup(rgName)
.withExistingPrimaryNetworkInterface(networkInterface1)
.withPopularWindowsImage(KnownWindowsVirtualMachineImage.WINDOWS_SERVER_2012_R2_DATACENTER)
- .withAdminUserName(userName)
- .withPassword(password)
+ .withAdminUsername(userName)
+ .withAdminPassword(password)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.withExistingSecondaryNetworkInterface(networkInterface2)
.withExistingSecondaryNetworkInterface(networkInterface3)
diff --git a/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageNetworkSecurityGroup.java b/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageNetworkSecurityGroup.java
index 64698a6e68445..0328f26631f99 100644
--- a/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageNetworkSecurityGroup.java
+++ b/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageNetworkSecurityGroup.java
@@ -225,7 +225,7 @@ public static void main(String[] args) {
.withExistingResourceGroup(rgName)
.withExistingPrimaryNetworkInterface(networkInterface1)
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
- .withRootUserName(userName)
+ .withRootUsername(userName)
.withSsh(sshKey)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.create();
@@ -251,7 +251,7 @@ public static void main(String[] args) {
.withExistingResourceGroup(rgName)
.withExistingPrimaryNetworkInterface(networkInterface2)
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
- .withRootUserName(userName)
+ .withRootUsername(userName)
.withSsh(sshKey)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.create();
diff --git a/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageVirtualMachinesInParallelWithNetwork.java b/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageVirtualMachinesInParallelWithNetwork.java
index cf477f9555967..22be53c054fcb 100644
--- a/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageVirtualMachinesInParallelWithNetwork.java
+++ b/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageVirtualMachinesInParallelWithNetwork.java
@@ -196,8 +196,8 @@ public static void main(String[] args) {
.withPrimaryPrivateIpAddressDynamic()
.withoutPrimaryPublicIpAddress()
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
- .withRootUserName(userName)
- .withPassword(password)
+ .withRootUsername(userName)
+ .withRootPassword(password)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.withNewStorageAccount(creatableStorageAccount);
frontendCreatableVirtualMachines.add(creatableVirtualMachine);
@@ -215,8 +215,8 @@ public static void main(String[] args) {
.withPrimaryPrivateIpAddressDynamic()
.withoutPrimaryPublicIpAddress()
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
- .withRootUserName(userName)
- .withPassword(password)
+ .withRootUsername(userName)
+ .withRootPassword(password)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.withNewStorageAccount(creatableStorageAccount);
backendCreatableVirtualMachines.add(creatableVirtualMachine);
diff --git a/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageVirtualNetwork.java b/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageVirtualNetwork.java
index a94948e4bd2a0..fc97d423b440b 100644
--- a/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageVirtualNetwork.java
+++ b/azure-samples/src/main/java/com/microsoft/azure/management/network/samples/ManageVirtualNetwork.java
@@ -191,7 +191,7 @@ public static void main(String[] args) {
.withPrimaryPrivateIpAddressDynamic()
.withNewPrimaryPublicIpAddress(publicIpAddressLeafDnsForFrontEndVm)
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
- .withRootUserName(userName)
+ .withRootUsername(userName)
.withSsh(sshKey)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.create();
@@ -217,7 +217,7 @@ public static void main(String[] args) {
.withPrimaryPrivateIpAddressDynamic()
.withoutPrimaryPublicIpAddress()
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
- .withRootUserName(userName)
+ .withRootUsername(userName)
.withSsh(sshKey)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.create();
diff --git a/azure/src/test/java/com/microsoft/azure/management/AzureTests.java b/azure/src/test/java/com/microsoft/azure/management/AzureTests.java
index 520c9a5b0bee6..dfe835d1a437d 100644
--- a/azure/src/test/java/com/microsoft/azure/management/AzureTests.java
+++ b/azure/src/test/java/com/microsoft/azure/management/AzureTests.java
@@ -281,6 +281,15 @@ public void testLoadBalancersInternalMinimum() throws Exception {
.runTest(azure.virtualMachines(), azure.resourceGroups());
}
+ @Test public void testVirtualMachineCustomData() throws Exception {
+ new TestVirtualMachineCustomData(azure.publicIpAddresses())
+ .runTest(azure.virtualMachines(), azure.resourceGroups());
+ }
+
+ @Test public void testVirtualMachineInAvailabilitySet() throws Exception {
+ new TestVirtualMachineInAvailabilitySet().runTest(azure.virtualMachines(), azure.resourceGroups());
+ }
+
@Test
public void listSubscriptions() throws Exception {
Assert.assertTrue(0 < subscriptions.list().size());
diff --git a/azure/src/test/java/com/microsoft/azure/management/TestLoadBalancer.java b/azure/src/test/java/com/microsoft/azure/management/TestLoadBalancer.java
index c15a6c75c6296..160a8141e0a48 100644
--- a/azure/src/test/java/com/microsoft/azure/management/TestLoadBalancer.java
+++ b/azure/src/test/java/com/microsoft/azure/management/TestLoadBalancer.java
@@ -625,8 +625,8 @@ private static VirtualMachine[] ensureVMs(Networks networks, VirtualMachines vms
.withPrimaryPrivateIpAddressDynamic()
.withoutPrimaryPublicIpAddress()
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_14_04_LTS)
- .withRootUserName(userName)
- .withPassword("Abcdef.123456")
+ .withRootUsername(userName)
+ .withRootPassword("Abcdef.123456")
.withNewAvailabilitySet(availabilitySetName)
.withSize(VirtualMachineSizeTypes.STANDARD_A1)
.create();
diff --git a/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachine.java b/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachine.java
index 595532e02ccac..7aee3afa5ddfe 100644
--- a/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachine.java
+++ b/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachine.java
@@ -30,8 +30,8 @@ public VirtualMachine createResource(VirtualMachines virtualMachines) throws Exc
.withPrimaryPrivateIpAddressDynamic()
.withoutPrimaryPublicIpAddress()
.withPopularWindowsImage(KnownWindowsVirtualMachineImage.WINDOWS_SERVER_2012_R2_DATACENTER)
- .withAdminUserName("testuser")
- .withPassword("12NewPA$$w0rd!")
+ .withAdminUsername("testuser")
+ .withAdminPassword("12NewPA$$w0rd!")
.withSize(VirtualMachineSizeTypes.STANDARD_D1_V2)
.createAsync()
.subscribe(new Action1() {
diff --git a/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineCustomData.java b/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineCustomData.java
new file mode 100644
index 0000000000000..9a7dabce14340
--- /dev/null
+++ b/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineCustomData.java
@@ -0,0 +1,109 @@
+package com.microsoft.azure.management;
+
+import com.jcraft.jsch.ChannelExec;
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.Session;
+import com.microsoft.azure.management.compute.KnownLinuxVirtualMachineImage;
+import com.microsoft.azure.management.compute.VirtualMachine;
+import com.microsoft.azure.management.compute.VirtualMachineSizeTypes;
+import com.microsoft.azure.management.compute.VirtualMachines;
+import com.microsoft.azure.management.network.PublicIpAddress;
+import com.microsoft.azure.management.network.PublicIpAddresses;
+import com.microsoft.azure.management.resources.fluentcore.arm.Region;
+import com.microsoft.azure.management.resources.fluentcore.utils.ResourceNamer;
+import org.apache.commons.codec.binary.Base64;
+import org.junit.Assert;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+public class TestVirtualMachineCustomData extends TestTemplate {
+ final PublicIpAddresses pips;
+
+ public TestVirtualMachineCustomData(PublicIpAddresses pips) {
+ this.pips = pips;
+ }
+
+ @Override
+ public VirtualMachine createResource(VirtualMachines virtualMachines) throws Exception {
+ final String vmName = "vm" + this.testId;
+ final String publicIpDnsLabel = ResourceNamer.randomResourceName("abc", 16);
+
+ // Prepare the custom data
+ //
+ String cloudInitFilePath = getClass().getClassLoader().getResource("cloud-init").getPath();
+ cloudInitFilePath = cloudInitFilePath.replaceFirst("^/(.:/)", "$1"); // In Windows remove leading slash
+ byte[] cloudInitAsBytes = Files.readAllBytes(Paths.get(cloudInitFilePath));
+ byte[] cloudInitEncoded = Base64.encodeBase64(cloudInitAsBytes);
+ String cloudInitEncodedString = new String(cloudInitEncoded);
+
+ PublicIpAddress pip = pips.define(publicIpDnsLabel)
+ .withRegion(Region.US_EAST)
+ .withNewResourceGroup()
+ .withLeafDomainLabel(publicIpDnsLabel)
+ .create();
+
+ VirtualMachine vm = virtualMachines.define(vmName)
+ .withRegion(pip.regionName())
+ .withExistingResourceGroup(pip.resourceGroupName())
+ .withNewPrimaryNetwork("10.0.0.0/28")
+ .withPrimaryPrivateIpAddressDynamic()
+ .withExistingPrimaryPublicIpAddress(pip)
+ .withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
+ .withRootUsername("testuser")
+ .withRootPassword("12NewPA$$w0rd!")
+ .withCustomData(cloudInitEncodedString)
+ .withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
+ .create();
+
+ pip.refresh();
+ Assert.assertTrue(pip.hasAssignedNetworkInterface());
+
+ JSch jsch= new JSch();
+ Session session = null;
+ ChannelExec channel = null;
+ try {
+ java.util.Properties config = new java.util.Properties();
+ config.put("StrictHostKeyChecking", "no");
+ session=jsch.getSession("testuser", publicIpDnsLabel + "." + "eastus.cloudapp.azure.com", 22);
+ session.setPassword("12NewPA$$w0rd!");
+ session.setConfig(config);
+ session.connect();
+
+ // Try running the package installed via init script
+ //
+ channel = (ChannelExec) session.openChannel("exec");
+ BufferedReader in=new BufferedReader(new InputStreamReader(channel.getInputStream()));
+ channel.setCommand("pwgen;");
+ channel.connect();
+
+ String msg;
+ while((msg = in.readLine()) != null){
+ Assert.assertFalse(msg.startsWith("The program 'pwgen' is currently not installed"));
+ }
+ } catch (Exception e) {
+ Assert.fail("SSH connection failed" + e.getMessage());
+ }finally {
+ if (channel != null) {
+ channel.disconnect();
+ }
+
+ if(session != null) {
+ session.disconnect();
+ }
+ }
+ return vm;
+ }
+
+ @Override
+ public VirtualMachine updateResource(VirtualMachine virtualMachine) throws Exception {
+ return virtualMachine;
+ }
+
+ @Override
+ public void print(VirtualMachine virtualMachine) {
+ TestUtils.print(virtualMachine);
+ }
+}
diff --git a/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineDataDisk.java b/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineDataDisk.java
index 6985f0d64e131..5f4772cb50e0a 100644
--- a/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineDataDisk.java
+++ b/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineDataDisk.java
@@ -26,8 +26,8 @@ public VirtualMachine createResource(VirtualMachines virtualMachines) throws Exc
.withPrimaryPrivateIpAddressDynamic()
.withoutPrimaryPublicIpAddress()
.withPopularWindowsImage(KnownWindowsVirtualMachineImage.WINDOWS_SERVER_2012_R2_DATACENTER)
- .withAdminUserName("testuser")
- .withPassword("12NewPA$$w0rd!")
+ .withAdminUsername("testuser")
+ .withAdminPassword("12NewPA$$w0rd!")
.withSize(VirtualMachineSizeTypes.STANDARD_A8)
.withNewDataDisk(30)
.defineNewDataDisk("disk2")
diff --git a/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineInAvailabilitySet.java b/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineInAvailabilitySet.java
new file mode 100644
index 0000000000000..b65af53a4c893
--- /dev/null
+++ b/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineInAvailabilitySet.java
@@ -0,0 +1,47 @@
+package com.microsoft.azure.management;
+
+import com.microsoft.azure.management.compute.KnownLinuxVirtualMachineImage;
+import com.microsoft.azure.management.compute.VirtualMachine;
+import com.microsoft.azure.management.compute.VirtualMachineSizeTypes;
+import com.microsoft.azure.management.compute.VirtualMachines;
+import com.microsoft.azure.management.resources.fluentcore.arm.Region;
+import com.microsoft.azure.management.resources.fluentcore.utils.ResourceNamer;
+import org.junit.Assert;
+
+public class TestVirtualMachineInAvailabilitySet extends TestTemplate {
+ @Override
+ public VirtualMachine createResource(VirtualMachines virtualMachines) throws Exception {
+ final String vmName = "vm" + this.testId;
+ final String newRgName = ResourceNamer.randomResourceName("rgVmInAvail", 10);
+ final String newAvailSetName = ResourceNamer.randomResourceName("avai", 10);
+
+ VirtualMachine vm = virtualMachines.define(vmName)
+ .withRegion(Region.US_EAST)
+ .withNewResourceGroup(newRgName)
+ .withNewPrimaryNetwork("10.0.0.0/28")
+ .withPrimaryPrivateIpAddressDynamic()
+ .withoutPrimaryPublicIpAddress()
+ .withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
+ .withRootUsername("testuser")
+ .withRootPassword("12NewPA$$w0rd!")
+ .withComputerName("myvm123")
+ .withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
+ .withNewAvailabilitySet(newAvailSetName)
+ .create();
+
+ Assert.assertNotNull(vm.availabilitySetId());
+ Assert.assertNotNull(vm.computerName());
+ Assert.assertTrue(vm.computerName().equalsIgnoreCase("myvm123"));
+ return vm;
+ }
+
+ @Override
+ public VirtualMachine updateResource(VirtualMachine virtualMachine) throws Exception {
+ return virtualMachine;
+ }
+
+ @Override
+ public void print(VirtualMachine virtualMachine) {
+ TestUtils.print(virtualMachine);
+ }
+}
diff --git a/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineNics.java b/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineNics.java
index 4639981e1dc50..67091a4316b60 100644
--- a/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineNics.java
+++ b/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineNics.java
@@ -81,8 +81,8 @@ public VirtualMachine createResource(VirtualMachines virtualMachines) throws Exc
.withPrimaryPrivateIpAddressStatic("10.0.0.4")
.withNewPrimaryPublicIpAddress(primaryPipName)
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_14_04_LTS)
- .withRootUserName("testuser")
- .withPassword("12NewPA$$w0rd!")
+ .withRootUsername("testuser")
+ .withRootPassword("12NewPA$$w0rd!")
.withSize(VirtualMachineSizeTypes.STANDARD_A9)
.withNewSecondaryNetworkInterface(secondaryNetworkInterfaceCreatable)
.withNewSecondaryNetworkInterface(secondaryNetworkInterfaceCreatable2)
diff --git a/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineSizes.java b/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineSizes.java
index 7b054f0c143f7..c6faf585df8fb 100644
--- a/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineSizes.java
+++ b/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineSizes.java
@@ -29,8 +29,8 @@ public VirtualMachine createResource(VirtualMachines virtualMachines) throws Exc
.withPrimaryPrivateIpAddressDynamic()
.withoutPrimaryPublicIpAddress()
.withPopularWindowsImage(KnownWindowsVirtualMachineImage.WINDOWS_SERVER_2012_R2_DATACENTER)
- .withAdminUserName("testuser")
- .withPassword("12NewPA$$w0rd!")
+ .withAdminUsername("testuser")
+ .withAdminPassword("12NewPA$$w0rd!")
.withSize(availableSizes.get(0).name()) // Use the first size
.create();
diff --git a/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineSsh.java b/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineSsh.java
index 5721469e684eb..a46541c0d9fb9 100644
--- a/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineSsh.java
+++ b/azure/src/test/java/com/microsoft/azure/management/TestVirtualMachineSsh.java
@@ -15,8 +15,14 @@
import com.microsoft.azure.management.network.PublicIpAddresses;
import com.microsoft.azure.management.compute.VirtualMachineSizeTypes;
import com.microsoft.azure.management.resources.fluentcore.arm.Region;
+import org.apache.commons.codec.binary.Base64;
import org.junit.Assert;
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
public class TestVirtualMachineSsh extends TestTemplate {
final PublicIpAddresses pips;
public TestVirtualMachineSsh(PublicIpAddresses pips) {
@@ -41,9 +47,9 @@ public VirtualMachine createResource(VirtualMachines virtualMachines) throws Exc
.withPrimaryPrivateIpAddressDynamic()
.withExistingPrimaryPublicIpAddress(pip)
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_14_04_LTS)
- .withRootUserName("testuser")
+ .withRootUsername("testuser")
+ .withRootPassword("12NewPA$$w0rd!")
.withSsh(sshKey)
- .withPassword("12NewPA$$w0rd!")
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.create();
diff --git a/azure/src/test/resources/cloud-init b/azure/src/test/resources/cloud-init
new file mode 100644
index 0000000000000..f620984b5a09f
--- /dev/null
+++ b/azure/src/test/resources/cloud-init
@@ -0,0 +1,3 @@
+#cloud-config
+packages:
+ - pwgen
\ No newline at end of file