Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
troettinger authored Jun 8, 2018
2 parents ed70648 + d33500f commit a6c6b54
Show file tree
Hide file tree
Showing 11 changed files with 1,369 additions and 523 deletions.
40 changes: 24 additions & 16 deletions ComputeAdmin/AzureStack.ComputeAdmin.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function Add-AzsVMImage {

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

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

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

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

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

Write-Verbose -Message "Deleting VM Image" -Verbose
Write-Verbose -Message "Deleting VM Image"
Remove-AzureRmResource @params -Force
}
catch {
Expand All @@ -380,7 +380,7 @@ function Remove-AzsVMImage {
}

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

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

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

[Parameter()]
[bool] $Net35 = $true,


[Parameter()]
[string] $MarketPlaceZipPath
[string] $MarketPlaceZipPath,



[Parameter()][alias('sku_version')]
[version]$osImageSkuVersion = (date -Format yyyy.MM.dd).ToString()

)
begin {
Expand Down Expand Up @@ -567,7 +573,7 @@ function New-AzsServer2016VMImage {
process {

$location = Get-AzsHomeLocation -Location $location
Write-Verbose -Message "Checking ISO path for a valid ISO." -Verbose
Write-Verbose -Message "Checking ISO path for a valid ISO."
if (!$IsoPath.ToLower().contains('.iso')) {
Write-Error -Message "ISO path is not a valid ISO file." -ErrorAction Stop
}
Expand Down Expand Up @@ -596,7 +602,7 @@ function New-AzsServer2016VMImage {
else {
if ($IncludeLatestCU) {
#for latest CU, check https://support.microsoft.com/en-us/help/4000825/windows-10-and-windows-server-2016-update-history
$Uri = 'http://download.windowsupdate.com/c/msdownload/update/software/secu/2017/10/windows10.0-kb4041691-x64_6b578432462f6bec9b4c903b3119d437ef32eb29.msu'
$Uri = 'http://download.windowsupdate.com/d/msdownload/update/software/updt/2018/05/windows10.0-kb4103720-x64_c1fb7676d38fffae5c28b9216220c1f033ce26ac.msu'
$OutFile = "$ModulePath\update.msu"
}
else {
Expand All @@ -612,7 +618,7 @@ function New-AzsServer2016VMImage {
}
$CurrentProgressPref = $ProgressPreference
$ProgressPreference = 'SilentlyContinue'
Write-Verbose -Message "Starting download of CU. This will take some time." -Verbose
Write-Verbose -Message "Starting download of CU. This will take some time."
Invoke-WebRequest -Uri $Uri -OutFile $OutFile -UseBasicParsing
$ProgressPreference = $CurrentProgressPref
Unblock-File -Path $OutFile
Expand All @@ -636,7 +642,7 @@ function New-AzsServer2016VMImage {
$PublishArguments = @{
publisher = 'MicrosoftWindowsServer'
offer = 'WindowsServer'
version = '1.0.0'
version = $osImageSkuVersion.ToString()
osType = 'Windows'
location = $location
}
Expand All @@ -656,7 +662,7 @@ function New-AzsServer2016VMImage {
try {
if ((!(Test-Path -Path $ImagePath)) -and (!$VMImageAlreadyAvailable)) {
Write-Verbose -Message "Creating Server Core Image"
CreateWindowsVHD @ConvertParams -VHDPath $ImagePath -Edition $CoreEdition -ErrorAction Stop -Verbose
CreateWindowsVHD @ConvertParams -VHDPath $ImagePath -Edition $CoreEdition -ErrorAction Stop
}
else {
Write-Verbose -Message "Server Core VHD already found."
Expand Down Expand Up @@ -690,8 +696,8 @@ function New-AzsServer2016VMImage {
}

if ((!(Test-Path -Path $ImagePath)) -and (!$VMImageAlreadyAvailable)) {
Write-Verbose -Message "Creating Server Full Image" -Verbose
CreateWindowsVHD @ConvertParams -VHDPath $ImagePath -Edition $FullEdition -ErrorAction Stop -Verbose
Write-Verbose -Message "Creating Server Full Image"
CreateWindowsVHD @ConvertParams -VHDPath $ImagePath -Edition $FullEdition -ErrorAction Stop
}
else {
Write-Verbose -Message "Server Full VHD already found."
Expand Down Expand Up @@ -725,7 +731,7 @@ Function CreateGalleryItem {
[ValidatePattern("[a-zA-Z0-9-]{3,}")]
[String] $Offer,

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

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


# Check if we were provided with the MarketPlace Item Generator File
if ( $MarketPlaceZipPath -eq '' )
{
Expand All @@ -765,6 +772,7 @@ Function CreateGalleryItem {
Write-Error "Failed to download Azure Stack Marketplace Item Generator" -ErrorAction Stop
}
}

}
}
else
Expand Down
2 changes: 1 addition & 1 deletion Connect/AzureStack.Connect.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See LICENSE.txt in the project root for license information.

#requires -Version 4.0
#requires -Modules AzureRM.Profile, VpnClient, AzureRM.AzureStackAdmin
#requires -Modules AzureRM.Profile, VpnClient

<#
.SYNOPSIS
Expand Down
Loading

0 comments on commit a6c6b54

Please sign in to comment.