Table of Contents
Introduction
Hello folks,
You might have seen the announcement on Windows Server 2019 preview that went out recently.
After installing Azure Stack Development Kit (ASDK) or Azure Stack Integrated Systems, we need to add a default Windows Server or Linux Image. If you deployed Azure Stack in connected mode and register it with public Azure, you can download Azure marketplaces items (known as marketplace syndication). For more details about this process, please check my earlier post below here.
Since Windows Server 2019 is just released in preview, the image is not available yet in public Azure, at the time of writing we cannot download it to Azure Stack.
In this post, I will show you how to add a custom Windows Server 2019 image to Azure Stack with PowerShell.
Add Windows Server 2019 image to Azure Stack
Assuming you already downloaded Azure Stack PowerShell and the required tools as described in the article above.
To create Windows Server 2019 custom image, complete the following steps:
- We need to prepare Windows Server 2019 image (fixed disk) in VHD format and NOT in VHDX format. Please note that Azure Stack does not support dynamic disks.
- Download Windows Server 2019 preview ISO image from here.
- Download Convert-WindowsImage.ps1 script from here.
- You can run the following script to create the image.
# Load (aka dot-source) the Function . .\Convert-WindowsImage.ps1 # Prepare all the variables $ConvertWindowsImageParam = @{ SourcePath = "D:\ASDK\Windows_InsiderPreview_Server_vNext_en-us_17623.iso" RemoteDesktopEnable = $True Passthru = $True WorkingDirectory = "E:\Temp\" SizeBytes = 40GB DiskType = "Fixed" VHDFormat = "VHD" VHDPartitionStyle = "MBR" Edition = @( "ServerDatacenter" ) } # Produce the image $VHD = Convert-WindowsImage @ConvertWindowsImageParam
To add Windows Server 2019 image to the Azure Stack Marketplace, complete the following steps:
- Import AzureStack Connect and ComputeAdmin modules:
# Import the Connect and ComputeAdmin Modules Set-Location C:\AzureStack-Tools-master\Connect Import-Module .\AzureStack.Connect.psm1 -Verbose Set-Location C:\AzureStack-Tools-master\ComputeAdmin Import-Module .\AzureStack.ComputeAdmin.psm1 -Verbose
- Login to Azure Stack environment by running the following command:
# Set the ARM Endpoint For Azure Stack Development Kit $ArmEndpoint = "https://adminmanagement.local.azurestack.external" # Set the Graph For Azure Stack Development Kit $GraphAudience = "https://graph.windows.net/" # Create the Azure Stack operator's Azure Resource Manager environment by using the following cmdlet: Add-AzureRMEnvironment -Name "AzureStackAdmin" -ArmEndpoint $ArmEndpoint # Note: For Azure Active Directory (AAD) run the following command Set-AzureRmEnvironment -Name "AzureStackAdmin" -GraphAudience $GraphAudience $TenantID = Get-AzsDirectoryTenantId -AADTenantName "https://charbelnemnom.com" -EnvironmentName AzureStackAdmin # Note: For Active Directory Federation Services (ADFS) run the following command Set-AzureRmEnvironment -Name "AzureStackAdmin" -GraphAudience $GraphAudience -EnableAdfsAuthentication:$true $TenantID = Get-AzsDirectoryTenantId -ADFS -EnvironmentName AzureStackAdmin # Login to Azure Stack Login-AzureRmAccount -EnvironmentName "AzureStackAdmin" -TenantId $TenantID
- Add Windows Server 2019 custom VM image by running the following command:
# Add Windows Server 2019 Image Add-AzsVMImage ` -Publisher "Microsoft" ` -Offer "WindowsServer" ` -Sku "Datacenter2019" ` -Version "17623.0.0" ` -OsType Windows ` -OSDiskLocalPath "E:\Temp\17623_WindowsServer2019_Datacenter_en-US.vhd"
And that process takes a little bit of time. In this example, it took little over 6 minutes.
What happens behind the scenes is the following: First, we will authenticate to the Azure Stack environment, upload the local VHD image to a newly created temporary storage account, and then adds the VM image to the VM image repository, and finally creates a Marketplace item. When the image is added successfully, you will receive a similar message to the following:
Verify Windows Server 2019 image is available in Azure Stack
To verify that the image is added successfully, in the portal, go to the Marketplace, and verify that the VM image is available in the Compute category.
The final step is to deploy the new image and verify that is running successfully. In the portal, go to New, click on Compute, select the newly added image and Create a new virtual machine.
Happy Evaluating Windows Server 2019 preview in Azure Stack!
__
Thank you for reading my blog.
If you have any questions or feedback, please leave a comment.
-Charbel Nemnom-