@@ -88,7 +88,7 @@ function Add-AzsVMImage {
88
88
89
89
[Parameter (Mandatory = $true , ParameterSetName = ' VMImageFromLocal' )]
90
90
[Parameter (Mandatory = $true , ParameterSetName = ' VMImageFromAzure' )]
91
- [ValidatePattern (" [a-zA-Z0-9-]{3,}" )]
91
+ [ValidatePattern (" [a-zA-Z0-9-\. ]{3,}" )]
92
92
[String ] $Sku ,
93
93
94
94
[Parameter (Mandatory = $true , ParameterSetName = ' VMImageFromLocal' )]
@@ -189,7 +189,7 @@ function Add-AzsVMImage {
189
189
if ($PSBoundParameters.ContainsKey (' dataDisksLocalPaths' )) {
190
190
foreach ($dataDiskLocalPath in $dataDisksLocalPaths ) {
191
191
$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
193
193
$dataDiskBlobURIsFromLocal.Add ($dataDiskBlobURI )
194
194
Add-AzureRmVhd - Destination $dataDiskBlobURI - ResourceGroupName $resourceGroupName - LocalFilePath $dataDiskLocalPath - OverWrite
195
195
}
@@ -334,7 +334,7 @@ function Remove-AzsVMImage {
334
334
[String ] $Offer ,
335
335
336
336
[Parameter (Mandatory = $true )]
337
- [ValidatePattern (" [a-zA-Z0-9-]{3,}" )]
337
+ [ValidatePattern (" [a-zA-Z0-9-\. ]{3,}" )]
338
338
[String ] $Sku ,
339
339
340
340
[Parameter (Mandatory = $true )]
@@ -353,7 +353,7 @@ function Remove-AzsVMImage {
353
353
354
354
$VMImageExists = $false
355
355
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"
357
357
$VMImageExists = $true
358
358
}
359
359
else {
@@ -370,7 +370,7 @@ function Remove-AzsVMImage {
370
370
ApiVersion = " 2015-12-01-preview"
371
371
}
372
372
373
- Write-Verbose - Message " Deleting VM Image" - Verbose
373
+ Write-Verbose - Message " Deleting VM Image"
374
374
Remove-AzureRmResource @params - Force
375
375
}
376
376
catch {
@@ -380,7 +380,7 @@ function Remove-AzsVMImage {
380
380
}
381
381
382
382
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."
384
384
$name = " $offer$sku "
385
385
# Remove periods so that the offer and sku can be retrieved from the Marketplace Item name
386
386
$name = $name -replace " \." , " -"
@@ -409,7 +409,7 @@ function Get-AzsVMImage {
409
409
[String ] $Offer ,
410
410
411
411
[Parameter (Mandatory = $true )]
412
- [ValidatePattern (" [a-zA-Z0-9-]{3,}" )]
412
+ [ValidatePattern (" [a-zA-Z0-9-\. ]{3,}" )]
413
413
[String ] $Sku ,
414
414
415
415
[Parameter (Mandatory = $true )]
@@ -474,9 +474,15 @@ function New-AzsServer2016VMImage {
474
474
475
475
[Parameter ()]
476
476
[bool ] $Net35 = $true ,
477
+
477
478
478
479
[Parameter ()]
479
- [string ] $MarketPlaceZipPath
480
+ [string ] $MarketPlaceZipPath ,
481
+
482
+
483
+
484
+ [Parameter ()][alias (' sku_version' )]
485
+ [version ]$osImageSkuVersion = (date - Format yyyy.MM.dd).ToString()
480
486
481
487
)
482
488
begin {
@@ -567,7 +573,7 @@ function New-AzsServer2016VMImage {
567
573
process {
568
574
569
575
$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."
571
577
if (! $IsoPath.ToLower ().contains(' .iso' )) {
572
578
Write-Error - Message " ISO path is not a valid ISO file." - ErrorAction Stop
573
579
}
@@ -596,7 +602,7 @@ function New-AzsServer2016VMImage {
596
602
else {
597
603
if ($IncludeLatestCU ) {
598
604
# 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'
600
606
$OutFile = " $ModulePath \update.msu"
601
607
}
602
608
else {
@@ -612,7 +618,7 @@ function New-AzsServer2016VMImage {
612
618
}
613
619
$CurrentProgressPref = $ProgressPreference
614
620
$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."
616
622
Invoke-WebRequest - Uri $Uri - OutFile $OutFile - UseBasicParsing
617
623
$ProgressPreference = $CurrentProgressPref
618
624
Unblock-File - Path $OutFile
@@ -636,7 +642,7 @@ function New-AzsServer2016VMImage {
636
642
$PublishArguments = @ {
637
643
publisher = ' MicrosoftWindowsServer'
638
644
offer = ' WindowsServer'
639
- version = ' 1.0.0 '
645
+ version = $osImageSkuVersion .ToString ()
640
646
osType = ' Windows'
641
647
location = $location
642
648
}
@@ -656,7 +662,7 @@ function New-AzsServer2016VMImage {
656
662
try {
657
663
if ((! (Test-Path - Path $ImagePath )) -and (! $VMImageAlreadyAvailable )) {
658
664
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
660
666
}
661
667
else {
662
668
Write-Verbose - Message " Server Core VHD already found."
@@ -690,8 +696,8 @@ function New-AzsServer2016VMImage {
690
696
}
691
697
692
698
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
695
701
}
696
702
else {
697
703
Write-Verbose - Message " Server Full VHD already found."
@@ -725,7 +731,7 @@ Function CreateGalleryItem {
725
731
[ValidatePattern (" [a-zA-Z0-9-]{3,}" )]
726
732
[String ] $Offer ,
727
733
728
- [ValidatePattern (" [a-zA-Z0-9-]{3,}" )]
734
+ [ValidatePattern (" [a-zA-Z0-9-\. ]{3,}" )]
729
735
[String ] $Sku ,
730
736
731
737
[ValidatePattern (" \d+\.\d+\.\d" )]
@@ -749,6 +755,7 @@ Function CreateGalleryItem {
749
755
New-Item - ItemType directory - Path $extractedGalleryItemPath | Out-Null
750
756
expand-archive - Path " $workdir \CustomizedVMGalleryItem.zip" - DestinationPath $extractedGalleryItemPath - Force
751
757
758
+
752
759
# Check if we were provided with the MarketPlace Item Generator File
753
760
if ( $MarketPlaceZipPath -eq ' ' )
754
761
{
@@ -765,6 +772,7 @@ Function CreateGalleryItem {
765
772
Write-Error " Failed to download Azure Stack Marketplace Item Generator" - ErrorAction Stop
766
773
}
767
774
}
775
+
768
776
}
769
777
}
770
778
else
0 commit comments