Skip to content

Commit ac0dccf

Browse files
committed
Hardcoding storage endpint suffix value for azure stack one node
1 parent 630ab93 commit ac0dccf

9 files changed

+232
-171
lines changed

src/ResourceManager/Compute/Stack/Commands.Compute.Test/ScenarioTests/ComputeTestCommon.ps1

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,24 @@ function Get-ComputeTestMode
8888
return $testMode;
8989
}
9090

91+
# Get Storage Endpoint Suffix
92+
function Get-StorageEndpointSuffix
93+
{
94+
return $env:STORAGEENDPOINTSUFFIX;
95+
}
96+
97+
# Get Default Storage Endpoint Suffix
98+
function Get-DefaultStorageEndpointSuffix
99+
{
100+
$storageEndpointSuffix = Get-StorageEndpointSuffix;
101+
if ($storageEndpointSuffix -eq '' -or $storageEndpointSuffix -eq $null)
102+
{
103+
$storageEndpointSuffix = 'local.azurestack.external';
104+
}
105+
106+
return $storageEndpointSuffix;
107+
}
108+
91109
# Get Compute Test Location
92110
function Get-ComputeTestLocation
93111
{
@@ -113,6 +131,7 @@ function Create-VirtualMachine($rgname, $vmname, $loc)
113131
$rgname = if ([string]::IsNullOrEmpty($rgname)) { Get-ComputeTestResourceName } else { $rgname }
114132
$vmname = if ([string]::IsNullOrEmpty($vmname)) { 'vm' + $rgname } else { $vmname }
115133
$loc = if ([string]::IsNullOrEmpty($loc)) { Get-ComputeVMLocation } else { $loc }
134+
$storageEndpointSuffix = Get-DefaultStorageEndpointSuffix;
116135

117136
# Common
118137
New-AzureRmResourceGroup -Name $rgname -Location $loc -Force;
@@ -147,10 +166,10 @@ function Create-VirtualMachine($rgname, $vmname, $loc)
147166

148167
$osDiskName = 'osDisk';
149168
$osDiskCaching = 'ReadWrite';
150-
$osDiskVhdUri = "https://$stoname.blob.$env:STORAGEENDPOINTSUFFIX/test/os.vhd";
151-
$dataDiskVhdUri1 = "https://$stoname.blob.$env:STORAGEENDPOINTSUFFIX/test/data1.vhd";
152-
$dataDiskVhdUri2 = "https://$stoname.blob.$env:STORAGEENDPOINTSUFFIX/test/data2.vhd";
153-
$dataDiskVhdUri3 = "https://$stoname.blob.$env:STORAGEENDPOINTSUFFIX/test/data3.vhd";
169+
$osDiskVhdUri = "https://$stoname.blob.$storageEndpointSuffix/test/os.vhd";
170+
$dataDiskVhdUri1 = "https://$stoname.blob.$storageEndpointSuffix/test/data1.vhd";
171+
$dataDiskVhdUri2 = "https://$stoname.blob.$storageEndpointSuffix/test/data2.vhd";
172+
$dataDiskVhdUri3 = "https://$stoname.blob.$storageEndpointSuffix/test/data3.vhd";
154173

155174
$p = Set-AzureRmVMOSDisk -VM $p -Name $osDiskName -VhdUri $osDiskVhdUri -Caching $osDiskCaching -CreateOption FromImage;
156175

@@ -178,7 +197,7 @@ function Create-VirtualMachine($rgname, $vmname, $loc)
178197
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force;
179198
$cred = New-Object System.Management.Automation.PSCredential ($user, $securePassword);
180199
$computerName = 'test';
181-
$vhdContainer = "https://$stoname.blob.$env:STORAGEENDPOINTSUFFIX/test";
200+
$vhdContainer = "https://$stoname.blob.$storageEndpointSuffix/test";
182201

183202
$p = Set-AzureRmVMOperatingSystem -VM $p -Windows -ComputerName $computerName -Credential $cred -ProvisionVMAgent;
184203

@@ -482,8 +501,9 @@ function Assert-OutputContains
482501
function Get-SasUri
483502
{
484503
param ([string] $storageAccount, [string] $storageKey, [string] $container, [string] $file, [TimeSpan] $duration, [Microsoft.WindowsAzure.Storage.Blob.SharedAccessBlobPermissions] $type)
504+
$storageEndpointSuffix = Get-DefaultStorageEndpointSuffix;
485505

486-
$uri = [string]::Format("https://{0}.blob.$env:STORAGEENDPOINTSUFFIX/{1}/{2}", $storageAccount, $container, $file);
506+
$uri = [string]::Format("https://{0}.blob.$storageEndpointSuffix/{1}/{2}", $storageAccount, $container, $file);
487507

488508
$destUri = New-Object -TypeName System.Uri($uri);
489509
$cred = New-Object -TypeName Microsoft.WindowsAzure.Storage.Auth.StorageCredentials($storageAccount, $storageKey);

src/ResourceManager/Compute/Stack/Commands.Compute.Test/ScenarioTests/DscExtensionTests.ps1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ function Test-GetAzureRmVMDscExtension
1818
{
1919
# Common
2020
New-AzureRmResourceGroup -Name $rgname -Location $loc -Force;
21-
21+
$storageEndpointSuffix = Get-DefaultStorageEndpointSuffix;
22+
2223
# VM Profile & Hardware
2324
$vmsize = 'Standard_A2';
2425
$vmname = 'vm' + $rgname;
@@ -49,8 +50,8 @@ function Test-GetAzureRmVMDscExtension
4950

5051
$osDiskName = 'osDisk';
5152
$osDiskCaching = 'ReadWrite';
52-
$osDiskVhdUri = "https://$stoname.blob.$env:STORAGEENDPOINTSUFFIX/test/os.vhd";
53-
$dataDiskVhdUri1 = "https://$stoname.blob.$env:STORAGEENDPOINTSUFFIX/test/data1.vhd";
53+
$osDiskVhdUri = "https://$stoname.blob.$storageEndpointSuffix/test/os.vhd";
54+
$dataDiskVhdUri1 = "https://$stoname.blob.$storageEndpointSuffix/test/data1.vhd";
5455

5556
$p = Set-AzureRmVMOSDisk -VM $p -Name $osDiskName -VhdUri $osDiskVhdUri -Caching $osDiskCaching -CreateOption FromImage;
5657
$p = Add-AzureRmVMDataDisk -VM $p -Name 'testDataDisk1' -Caching 'ReadOnly' -DiskSizeInGB 10 -Lun 1 -VhdUri $dataDiskVhdUri1 -CreateOption Empty;
@@ -61,7 +62,7 @@ function Test-GetAzureRmVMDscExtension
6162
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force;
6263
$cred = New-Object System.Management.Automation.PSCredential ($user, $securePassword);
6364
$computerName = 'test';
64-
$vhdContainer = "https://$stoname.blob.$env:STORAGEENDPOINTSUFFIX/test";
65+
$vhdContainer = "https://$stoname.blob.$storageEndpointSuffix/test";
6566

6667
$p = Set-AzureRmVMOperatingSystem -VM $p -Windows -ComputerName $computerName -Credential $cred -ProvisionVMAgent;
6768

src/ResourceManager/Compute/Stack/Commands.Compute.Test/ScenarioTests/VMDynamicTests.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,12 @@ $func_setup_image_and_disks =
241241
function setup_image_and_disks
242242
{
243243
param ([string] $loc, [string] $rgname, [string] $stoname, $vmconfig)
244+
$storageEndpointSuffix = Get-DefaultStorageEndpointSuffix;
244245
245246
$st = Write-Verbose "Setting up image and disks of VM config object jfor '${loc}', '${rgname}' and '${stoname}' - Start";
246247
247248
$osDiskName = 'osDisk';
248-
$osDiskVhdUri = "https://$stoname.blob.$env:STORAGEENDPOINTSUFFIX/test/os.vhd";
249+
$osDiskVhdUri = "https://$stoname.blob.$storageEndpointSuffix/test/os.vhd";
249250
$osDiskCaching = 'ReadWrite';
250251
251252
$vmconfig = Set-AzureRmVMOSDisk -VM $vmconfig -Name $osDiskName -VhdUri $osDiskVhdUri -Caching $osDiskCaching -CreateOption FromImage;

src/ResourceManager/Compute/Stack/Commands.Compute.Test/ScenarioTests/VirtualMachineBootDiagnosticsTests.ps1

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ function Test-VirtualMachineBootDiagnostics
2626
# Common
2727
$loc = Get-ComputeVMLocation;
2828
New-AzureRmResourceGroup -Name $rgname -Location $loc -Force;
29+
$storageEndpointSuffix = Get-DefaultStorageEndpointSuffix;
2930

3031
# VM Profile & Hardware
3132
$vmsize = 'Standard_A4';
@@ -63,9 +64,9 @@ function Test-VirtualMachineBootDiagnostics
6364

6465
$osDiskName = 'osDisk';
6566
$osDiskCaching = 'ReadWrite';
66-
$osDiskVhdUri = "https://$stoname.blob.$env:STORAGEENDPOINTSUFFIX/test/os.vhd";
67-
$dataDiskVhdUri1 = "https://$stoname.blob.$env:STORAGEENDPOINTSUFFIX/test/data1.vhd";
68-
$dataDiskVhdUri2 = "https://$stoname.blob.$env:STORAGEENDPOINTSUFFIX/test/data2.vhd";
67+
$osDiskVhdUri = "https://$stoname.blob.$storageEndpointSuffix/test/os.vhd";
68+
$dataDiskVhdUri1 = "https://$stoname.blob.$storageEndpointSuffix/test/data1.vhd";
69+
$dataDiskVhdUri2 = "https://$stoname.blob.$storageEndpointSuffix/test/data2.vhd";
6970

7071
$p = Set-AzureRmVMOSDisk -VM $p -Name $osDiskName -VhdUri $osDiskVhdUri -Caching $osDiskCaching -CreateOption FromImage;
7172
$p = Add-AzureRmVMDataDisk -VM $p -Name 'testDataDisk1' -Caching 'ReadOnly' -DiskSizeInGB 10 -Lun 1 -VhdUri $dataDiskVhdUri1 -CreateOption Empty;
@@ -90,7 +91,7 @@ function Test-VirtualMachineBootDiagnostics
9091
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force;
9192
$cred = New-Object System.Management.Automation.PSCredential ($user, $securePassword);
9293
$computerName = 'test';
93-
$vhdContainer = "https://$stoname.blob.$env:STORAGEENDPOINTSUFFIX/test";
94+
$vhdContainer = "https://$stoname.blob.$storageEndpointSuffix/test";
9495

9596
$p = Set-AzureRmVMOperatingSystem -VM $p -Windows -ComputerName $computerName -Credential $cred;
9697

@@ -195,6 +196,7 @@ function Test-VirtualMachineBootDiagnosticsPremium
195196
# Common
196197
$loc = Get-ComputeVMLocation;
197198
New-AzureRMResourceGroup -Name $rgname -Location $loc -Force;
199+
$storageEndpointSuffix = Get-DefaultStorageEndpointSuffix;
198200

199201
# VM Profile & Hardware
200202
$vmsize = 'Standard_DS1';
@@ -232,7 +234,7 @@ function Test-VirtualMachineBootDiagnosticsPremium
232234

233235
$osDiskName = 'osDisk';
234236
$osDiskCaching = 'None';
235-
$osDiskVhdUri = "https://$stoname.blob.$env:STORAGEENDPOINTSUFFIX/test/os.vhd";
237+
$osDiskVhdUri = "https://$stoname.blob.$storageEndpointSuffix/test/os.vhd";
236238

237239
$p = Set-AzureRMVMOSDisk -VM $p -Name $osDiskName -VhdUri $osDiskVhdUri -Caching $osDiskCaching -CreateOption FromImage;
238240

@@ -246,7 +248,7 @@ function Test-VirtualMachineBootDiagnosticsPremium
246248
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force;
247249
$cred = New-Object System.Management.Automation.PSCredential ($user, $securePassword);
248250
$computerName = 'test';
249-
$vhdContainer = "https://$stoname.blob.$env:STORAGEENDPOINTSUFFIX/test";
251+
$vhdContainer = "https://$stoname.blob.$storageEndpointSuffix/test";
250252

251253
$p = Set-AzureRMVMOperatingSystem -VM $p -Windows -ComputerName $computerName -Credential $cred;
252254

@@ -304,6 +306,7 @@ function Test-LinuxVirtualMachineBootDiagnostics
304306
# Common
305307
$loc = Get-ComputeVMLocation;
306308
New-AzureRMResourceGroup -Name $rgname -Location $loc -Force;
309+
$storageEndpointSuffix = Get-DefaultStorageEndpointSuffix;
307310

308311
# VM Profile & Hardware
309312
$vmsize = 'Standard_A4';
@@ -335,7 +338,7 @@ function Test-LinuxVirtualMachineBootDiagnostics
335338

336339
$osDiskName = 'osDisk';
337340
$osDiskCaching = 'ReadWrite';
338-
$osDiskVhdUri = "https://$stoname.blob.$env:STORAGEENDPOINTSUFFIX/test/os.vhd";
341+
$osDiskVhdUri = "https://$stoname.blob.$storageEndpointSuffix/test/os.vhd";
339342
$p = Set-AzureRMVMOSDisk -VM $p -Name $osDiskName -VhdUri $osDiskVhdUri -Caching $osDiskCaching -CreateOption FromImage;
340343

341344
Assert-AreEqual $p.StorageProfile.OSDisk.Caching $osDiskCaching;
@@ -348,7 +351,7 @@ function Test-LinuxVirtualMachineBootDiagnostics
348351
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force;
349352
$cred = New-Object System.Management.Automation.PSCredential ($user, $securePassword);
350353
$computerName = 'test';
351-
$vhdContainer = "https://$stoname.blob.$env:STORAGEENDPOINTSUFFIX/test";
354+
$vhdContainer = "https://$stoname.blob.$storageEndpointSuffix/test";
352355

353356
$imgRef = Get-DefaultCRPLinuxImageOffline;
354357

@@ -409,6 +412,7 @@ function Test-VirtualMachineBootDiagnosticsSet
409412
# Common
410413
$loc = Get-ComputeVMLocation;
411414
New-AzureRMResourceGroup -Name $rgname -Location $loc -Force;
415+
$storageEndpointSuffix = Get-DefaultStorageEndpointSuffix;
412416

413417
# VM Profile & Hardware
414418
$vmsize = 'Standard_A4';
@@ -451,7 +455,7 @@ function Test-VirtualMachineBootDiagnosticsSet
451455

452456
$osDiskName = 'osDisk';
453457
$osDiskCaching = 'ReadWrite';
454-
$osDiskVhdUri = "https://$stoname.blob.$env:STORAGEENDPOINTSUFFIX/test/os.vhd";
458+
$osDiskVhdUri = "https://$stoname.blob.$storageEndpointSuffix/test/os.vhd";
455459

456460
$p = Set-AzureRMVMOSDisk -VM $p -Name $osDiskName -VhdUri $osDiskVhdUri -Caching $osDiskCaching -CreateOption FromImage;
457461

@@ -465,7 +469,7 @@ function Test-VirtualMachineBootDiagnosticsSet
465469
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force;
466470
$cred = New-Object System.Management.Automation.PSCredential ($user, $securePassword);
467471
$computerName = 'test';
468-
$vhdContainer = "https://$stoname.blob.$env:STORAGEENDPOINTSUFFIX/test";
472+
$vhdContainer = "https://$stoname.blob.$storageEndpointSuffix/test";
469473

470474
$p = Set-AzureRMVMOperatingSystem -VM $p -Windows -ComputerName $computerName -Credential $cred;
471475

0 commit comments

Comments
 (0)