12
12
# limitations under the License.
13
13
# ----------------------------------------------------------------------------------
14
14
15
+ $PLACEHOLDER = " PLACEHOLDER1@" ;
16
+
15
17
<#
16
18
. SYNOPSIS
17
19
Tests Create-AzureVM with valid information.
@@ -33,8 +35,7 @@ function Test-GetAzureVM
33
35
34
36
# Test
35
37
New-AzureService - ServiceName $svcName - Location $location
36
- # [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine")]
37
- New-AzureQuickVM - Windows - ImageName $imgName - Name $vmName - ServiceName $svcName - AdminUsername " pstestuser" - Password " p@ssw0rd"
38
+ New-AzureQuickVM - Windows - ImageName $imgName - Name $vmName - ServiceName $svcName - AdminUsername " pstestuser" - Password $PLACEHOLDER
38
39
39
40
Get-AzureVM - ServiceName $svcName - Name $vmName
40
41
@@ -92,7 +93,7 @@ function Run-StartAndStopMultipleVirtualMachinesTest
92
93
$vmNameList = @ (" vm01" , " vm02" , " test04" );
93
94
$svcName = ' pstest' + (Get-CloudServiceName );
94
95
$userName = " pstestuser" ;
95
- $password = " p@ssw0rd " ;
96
+ $password = $PLACEHOLDER ;
96
97
97
98
# Test
98
99
New-AzureService - ServiceName $svcName - Location $location ;
@@ -153,7 +154,7 @@ function Run-AutoGeneratedHostedServiceCmdletTests
153
154
$vmNameList = @ (" vm01" , " vm02" , " test04" );
154
155
$svcName = ' pstest' + (Get-CloudServiceName );
155
156
$userName = " pstestuser" ;
156
- $password = " p@ssw0rd " ;
157
+ $password = $PLACEHOLDER ;
157
158
158
159
try
159
160
{
@@ -220,7 +221,7 @@ function Run-AutoGeneratedVirtualMachineCmdletTests
220
221
221
222
$svcName = ' pstest' + (Get-CloudServiceName );
222
223
$userName = " pstestuser" ;
223
- $password = " p@ssw0rd " ;
224
+ $password = $PLACEHOLDER ;
224
225
225
226
try
226
227
{
@@ -480,7 +481,7 @@ function Run-ServiceExtensionSetCmdletTests
480
481
481
482
$svcName = ' pstest' + (Get-CloudServiceName );
482
483
$userName = " pstestuser" ;
483
- $password = " p@ssw0rd " ;
484
+ $password = $PLACEHOLDER ;
484
485
$sPassword = ConvertTo-SecureString $password - AsPlainText - Force;
485
486
$credential = New-Object System.Management.Automation.PSCredential ($userName , $sPassword );
486
487
@@ -542,7 +543,7 @@ function Run-ServiceDeploymentExtensionCmdletTests
542
543
543
544
$svcName = ' pstest' + (Get-CloudServiceName );
544
545
$userName = " pstestuser" ;
545
- $password = " p@ssw0rd " ;
546
+ $password = $PLACEHOLDER ;
546
547
$sPassword = ConvertTo-SecureString $password - AsPlainText - Force;
547
548
$credential = New-Object System.Management.Automation.PSCredential ($userName , $sPassword );
548
549
@@ -630,8 +631,7 @@ function Test-MigrateAzureDeployment
630
631
631
632
# Test
632
633
New-AzureService - ServiceName $svcName - Location $location ;
633
- # [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine")]
634
- New-AzureQuickVM - Windows - ImageName $imgName - Name $vmName - ServiceName $svcName - AdminUsername " pstestuser" - Password " p@ssw0rd" ;
634
+ New-AzureQuickVM - Windows - ImageName $imgName - Name $vmName - ServiceName $svcName - AdminUsername " pstestuser" - Password $PLACEHOLDER ;
635
635
Get-AzureVM - ServiceName $svcName - Name $vmName ;
636
636
637
637
Move-AzureService - Prepare - ServiceName $svcName - DeploymentName $svcName - CreateNewVirtualNetwork;
@@ -670,10 +670,12 @@ function Test-MigrationAbortAzureDeployment
670
670
671
671
# Test
672
672
New-AzureService - ServiceName $svcName - Location $location ;
673
- # [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine")]
674
- New-AzureQuickVM - Windows - ImageName $imgName - Name $vmName - ServiceName $svcName - AdminUsername " pstestuser" - Password " p@ssw0rd" ;
673
+ New-AzureQuickVM - Windows - ImageName $imgName - Name $vmName - ServiceName $svcName - AdminUsername " pstestuser" - Password $PLACEHOLDER - WaitForBoot;
675
674
Get-AzureVM - ServiceName $svcName - Name $vmName ;
676
675
676
+ Move-AzureService - Validate - ServiceName $svcName - DeploymentName $svcName - CreateNewVirtualNetwork;
677
+ $vm = Get-AzureVM - ServiceName $svcName - Name $vmName ;
678
+
677
679
Move-AzureService - Prepare - ServiceName $svcName - DeploymentName $svcName - CreateNewVirtualNetwork;
678
680
$vm = Get-AzureVM - ServiceName $svcName - Name $vmName ;
679
681
Assert-AreEqual " Prepared" $vm.VM.MigrationState ;
@@ -733,15 +735,15 @@ function Test-MigrationAbortAzureVNet
733
735
# Test
734
736
735
737
Set-AzureVNetConfig - ConfigurationPath $vnetConfigPath ;
738
+ Get-AzureVNetSite ;
736
739
740
+ Move-AzureVirtualNetwork - Validate - VirtualNetworkName $vnetName ;
737
741
Get-AzureVNetSite ;
738
742
739
743
Move-AzureVirtualNetwork - Prepare - VirtualNetworkName $vnetName ;
740
-
741
744
Get-AzureVNetSite ;
742
745
743
746
Move-AzureVirtualNetwork - Abort - VirtualNetworkName $vnetName ;
744
-
745
747
Get-AzureVNetSite ;
746
748
747
749
# Cleanup
@@ -755,17 +757,17 @@ Tests Move-AzureStorageAccount with Prepare and Commit
755
757
function Test-MigrateAzureStorageAccount
756
758
{
757
759
# Setup
758
- $location = " Central US" ;
760
+ $location = " Central US" ;
759
761
$storageName = getAssetName;
760
762
New-AzureStorageAccount - StorageAccountName $storageName - Location $location ;
761
- Get-AzureStorageAccount - StorageAccountName $storageName ;
763
+ Get-AzureStorageAccount - StorageAccountName $storageName ;
762
764
763
765
# Test
764
766
Move-AzureStorageAccount - Prepare - StorageAccountName $storageName ;
765
767
Get-AzureStorageAccount - StorageAccountName $storageName ;
766
768
767
769
Move-AzureStorageAccount - Commit - StorageAccountName $storageName ;
768
- Assert-ThrowsContains { Get-AzureStorageAccount - StorageAccountName $storageName ; } " ResourceNotFound" ;
770
+ Assert-ThrowsContains { Get-AzureStorageAccount - StorageAccountName $storageName ; } " ResourceNotFound" ;
769
771
}
770
772
771
773
<#
@@ -775,12 +777,15 @@ Tests Move-AzureStorageAccount with Prepare and Abort
775
777
function Test-MigrationAbortAzureStorageAccount
776
778
{
777
779
# Setup
778
- $location = " Central US" ;
780
+ $location = " Central US" ;
779
781
$storageName = getAssetName;
780
782
New-AzureStorageAccount - StorageAccountName $storageName - Location $location ;
781
- Get-AzureStorageAccount - StorageAccountName $storageName ;
783
+ Get-AzureStorageAccount - StorageAccountName $storageName ;
782
784
783
785
# Test
786
+ Move-AzureStorageAccount - Validate - StorageAccountName $storageName ;
787
+ Get-AzureStorageAccount - StorageAccountName $storageName ;
788
+
784
789
Move-AzureStorageAccount - Prepare - StorageAccountName $storageName ;
785
790
Get-AzureStorageAccount - StorageAccountName $storageName ;
786
791
@@ -806,7 +811,7 @@ function Test-NewAzureVMWithBYOL
806
811
$licenseType = " Windows_Server" ;
807
812
$imgName = getAssetName;
808
813
$userName = " User" + $svcName ;
809
- $pass = " User@ " + $svcName ;
814
+ $pass = $PLACEHOLDER ;
810
815
811
816
$media1 = " http://mybyolosimagerdfe.blob.core.windows.net/myvhd/" + $svcName + " 0.vhd" ;
812
817
$media2 = " http://mybyolosimagerdfe.blob.core.windows.net/myvhd/" + $svcName + " 1.vhd" ;
@@ -848,3 +853,42 @@ function Test-NewAzureVMWithBYOL
848
853
# Cleanup
849
854
Cleanup- CloudService $svcName
850
855
}
856
+
857
+ # Test Redeploy VM
858
+ function Run-RedeployVirtualMachineTest
859
+ {
860
+ # Setup
861
+ $location = Get-DefaultLocation ;
862
+ $imgName = Get-DefaultImage $location ;
863
+
864
+ $storageName = ' pstest' + (getAssetName);
865
+ New-AzureStorageAccount - StorageAccountName $storageName - Location $location ;
866
+
867
+ # Associate the new storage account with the current subscription
868
+ Set-CurrentStorageAccountName $storageName ;
869
+
870
+ $vmName = " vm01" ;
871
+ $svcName = ' pstest' + (Get-CloudServiceName );
872
+ $userName = " pstestuser" ;
873
+ $password = $PLACEHOLDER ;
874
+
875
+ # Test
876
+ New-AzureService - ServiceName $svcName - Location $location ;
877
+
878
+ try
879
+ {
880
+ New-AzureQuickVM - Windows - ImageName $imgName - Name $vmName - ServiceName $svcName - AdminUsername $userName - Password $password ;
881
+ # Get VM
882
+ $vm = Get-AzureVM - ServiceName $svcName - Name $vmName ;
883
+
884
+ # Test Redeploy
885
+ Restart-AzureVM - Redeploy - ServiceName $svcName - Name $vmName ;
886
+
887
+ $vm = Get-AzureVM - ServiceName $svcName - Name $vmName ;
888
+ }
889
+ finally
890
+ {
891
+ # Cleanup
892
+ Cleanup- CloudService $svcName ;
893
+ }
894
+ }
0 commit comments