Skip to content

Commit a6c6b54

Browse files
authored
Merge branch 'master' into master
2 parents ed70648 + d33500f commit a6c6b54

11 files changed

+1369
-523
lines changed

ComputeAdmin/AzureStack.ComputeAdmin.psm1

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function Add-AzsVMImage {
8888

8989
[Parameter(Mandatory = $true, ParameterSetName = 'VMImageFromLocal')]
9090
[Parameter(Mandatory = $true, ParameterSetName = 'VMImageFromAzure')]
91-
[ValidatePattern("[a-zA-Z0-9-]{3,}")]
91+
[ValidatePattern("[a-zA-Z0-9-\.]{3,}")]
9292
[String] $Sku,
9393

9494
[Parameter(Mandatory = $true, ParameterSetName = 'VMImageFromLocal')]
@@ -189,7 +189,7 @@ function Add-AzsVMImage {
189189
if ($PSBoundParameters.ContainsKey('dataDisksLocalPaths')) {
190190
foreach ($dataDiskLocalPath in $dataDisksLocalPaths) {
191191
$dataDiskName = Split-Path $dataDiskLocalPath -Leaf
192-
$dataDiskBlobURI = "https://$storageAccountName.blob.$Domain/$containerName/$dataDiskName"
192+
$dataDiskBlobURI = '{0}{1}/{2}' -f $storageAccount.PrimaryEndpoints.Blob.AbsoluteUri, $containerName, $dataDiskName
193193
$dataDiskBlobURIsFromLocal.Add($dataDiskBlobURI)
194194
Add-AzureRmVhd -Destination $dataDiskBlobURI -ResourceGroupName $resourceGroupName -LocalFilePath $dataDiskLocalPath -OverWrite
195195
}
@@ -334,7 +334,7 @@ function Remove-AzsVMImage {
334334
[String] $Offer,
335335

336336
[Parameter(Mandatory = $true)]
337-
[ValidatePattern("[a-zA-Z0-9-]{3,}")]
337+
[ValidatePattern("[a-zA-Z0-9-\.]{3,}")]
338338
[String] $Sku,
339339

340340
[Parameter(Mandatory = $true)]
@@ -353,7 +353,7 @@ function Remove-AzsVMImage {
353353

354354
$VMImageExists = $false
355355
if (Get-AzsVMImage -publisher $publisher -offer $offer -sku $sku -version $version -location $location -ErrorAction SilentlyContinue) {
356-
Write-Verbose "VM Image is present in Azure Stack - continuing to remove" -Verbose
356+
Write-Verbose "VM Image is present in Azure Stack - continuing to remove"
357357
$VMImageExists = $true
358358
}
359359
else {
@@ -370,7 +370,7 @@ function Remove-AzsVMImage {
370370
ApiVersion = "2015-12-01-preview"
371371
}
372372

373-
Write-Verbose -Message "Deleting VM Image" -Verbose
373+
Write-Verbose -Message "Deleting VM Image"
374374
Remove-AzureRmResource @params -Force
375375
}
376376
catch {
@@ -380,7 +380,7 @@ function Remove-AzsVMImage {
380380
}
381381

382382
if (-not $KeepMarketplaceItem) {
383-
Write-Verbose "Removing the marketplace item for the VM Image." -Verbose
383+
Write-Verbose "Removing the marketplace item for the VM Image."
384384
$name = "$offer$sku"
385385
#Remove periods so that the offer and sku can be retrieved from the Marketplace Item name
386386
$name = $name -replace "\.", "-"
@@ -409,7 +409,7 @@ function Get-AzsVMImage {
409409
[String] $Offer,
410410

411411
[Parameter(Mandatory = $true)]
412-
[ValidatePattern("[a-zA-Z0-9-]{3,}")]
412+
[ValidatePattern("[a-zA-Z0-9-\.]{3,}")]
413413
[String] $Sku,
414414

415415
[Parameter(Mandatory = $true)]
@@ -474,9 +474,15 @@ function New-AzsServer2016VMImage {
474474

475475
[Parameter()]
476476
[bool] $Net35 = $true,
477+
477478

478479
[Parameter()]
479-
[string] $MarketPlaceZipPath
480+
[string] $MarketPlaceZipPath,
481+
482+
483+
484+
[Parameter()][alias('sku_version')]
485+
[version]$osImageSkuVersion = (date -Format yyyy.MM.dd).ToString()
480486

481487
)
482488
begin {
@@ -567,7 +573,7 @@ function New-AzsServer2016VMImage {
567573
process {
568574

569575
$location = Get-AzsHomeLocation -Location $location
570-
Write-Verbose -Message "Checking ISO path for a valid ISO." -Verbose
576+
Write-Verbose -Message "Checking ISO path for a valid ISO."
571577
if (!$IsoPath.ToLower().contains('.iso')) {
572578
Write-Error -Message "ISO path is not a valid ISO file." -ErrorAction Stop
573579
}
@@ -596,7 +602,7 @@ function New-AzsServer2016VMImage {
596602
else {
597603
if ($IncludeLatestCU) {
598604
#for latest CU, check https://support.microsoft.com/en-us/help/4000825/windows-10-and-windows-server-2016-update-history
599-
$Uri = 'http://download.windowsupdate.com/c/msdownload/update/software/secu/2017/10/windows10.0-kb4041691-x64_6b578432462f6bec9b4c903b3119d437ef32eb29.msu'
605+
$Uri = 'http://download.windowsupdate.com/d/msdownload/update/software/updt/2018/05/windows10.0-kb4103720-x64_c1fb7676d38fffae5c28b9216220c1f033ce26ac.msu'
600606
$OutFile = "$ModulePath\update.msu"
601607
}
602608
else {
@@ -612,7 +618,7 @@ function New-AzsServer2016VMImage {
612618
}
613619
$CurrentProgressPref = $ProgressPreference
614620
$ProgressPreference = 'SilentlyContinue'
615-
Write-Verbose -Message "Starting download of CU. This will take some time." -Verbose
621+
Write-Verbose -Message "Starting download of CU. This will take some time."
616622
Invoke-WebRequest -Uri $Uri -OutFile $OutFile -UseBasicParsing
617623
$ProgressPreference = $CurrentProgressPref
618624
Unblock-File -Path $OutFile
@@ -636,7 +642,7 @@ function New-AzsServer2016VMImage {
636642
$PublishArguments = @{
637643
publisher = 'MicrosoftWindowsServer'
638644
offer = 'WindowsServer'
639-
version = '1.0.0'
645+
version = $osImageSkuVersion.ToString()
640646
osType = 'Windows'
641647
location = $location
642648
}
@@ -656,7 +662,7 @@ function New-AzsServer2016VMImage {
656662
try {
657663
if ((!(Test-Path -Path $ImagePath)) -and (!$VMImageAlreadyAvailable)) {
658664
Write-Verbose -Message "Creating Server Core Image"
659-
CreateWindowsVHD @ConvertParams -VHDPath $ImagePath -Edition $CoreEdition -ErrorAction Stop -Verbose
665+
CreateWindowsVHD @ConvertParams -VHDPath $ImagePath -Edition $CoreEdition -ErrorAction Stop
660666
}
661667
else {
662668
Write-Verbose -Message "Server Core VHD already found."
@@ -690,8 +696,8 @@ function New-AzsServer2016VMImage {
690696
}
691697

692698
if ((!(Test-Path -Path $ImagePath)) -and (!$VMImageAlreadyAvailable)) {
693-
Write-Verbose -Message "Creating Server Full Image" -Verbose
694-
CreateWindowsVHD @ConvertParams -VHDPath $ImagePath -Edition $FullEdition -ErrorAction Stop -Verbose
699+
Write-Verbose -Message "Creating Server Full Image"
700+
CreateWindowsVHD @ConvertParams -VHDPath $ImagePath -Edition $FullEdition -ErrorAction Stop
695701
}
696702
else {
697703
Write-Verbose -Message "Server Full VHD already found."
@@ -725,7 +731,7 @@ Function CreateGalleryItem {
725731
[ValidatePattern("[a-zA-Z0-9-]{3,}")]
726732
[String] $Offer,
727733

728-
[ValidatePattern("[a-zA-Z0-9-]{3,}")]
734+
[ValidatePattern("[a-zA-Z0-9-\.]{3,}")]
729735
[String] $Sku,
730736

731737
[ValidatePattern("\d+\.\d+\.\d")]
@@ -749,6 +755,7 @@ Function CreateGalleryItem {
749755
New-Item -ItemType directory -Path $extractedGalleryItemPath | Out-Null
750756
expand-archive -Path "$workdir\CustomizedVMGalleryItem.zip" -DestinationPath $extractedGalleryItemPath -Force
751757

758+
752759
# Check if we were provided with the MarketPlace Item Generator File
753760
if ( $MarketPlaceZipPath -eq '' )
754761
{
@@ -765,6 +772,7 @@ Function CreateGalleryItem {
765772
Write-Error "Failed to download Azure Stack Marketplace Item Generator" -ErrorAction Stop
766773
}
767774
}
775+
768776
}
769777
}
770778
else

Connect/AzureStack.Connect.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See LICENSE.txt in the project root for license information.
33

44
#requires -Version 4.0
5-
#requires -Modules AzureRM.Profile, VpnClient, AzureRM.AzureStackAdmin
5+
#requires -Modules AzureRM.Profile, VpnClient
66

77
<#
88
.SYNOPSIS

0 commit comments

Comments
 (0)