Add Windows Server 2019 Image to #AzureStack #AzureStackDevKit #WindowsServer2019

3 min read


Hello folks,

You might have seen the announcement on Windows Server 2019 preview that went out recently.

Microsoft Announced The Preview Release Of Windows Server 2019

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:

How to Add Windows Server 2016 Image to #AzureStack #AzureStackDevKit #WindowsServer

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:

  1. 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.
  2. Download Windows Server 2019 preview ISO image from here.
  3. Download Convert-WindowsImage.ps1 script from here.
  4. 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    = @(       
    # Produce the image 
    $VHD = Convert-WindowsImage @ConvertWindowsImageParam

To add Windows Server 2019 image to the Azure Stack Marketplace, complete the following steps:

  1. 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
  2. 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 = ""
    # 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 "" -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
  3. 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-

About Charbel Nemnom 559 Articles
Charbel Nemnom is a Cloud Architect, ICT Security Expert, Microsoft Most Valuable Professional (MVP), and Microsoft Certified Trainer (MCT), totally fan of the latest's IT platform solutions, accomplished hands-on technical professional with over 17 years of broad IT Infrastructure experience serving on and guiding technical teams to optimize the performance of mission-critical enterprise systems. Excellent communicator is adept at identifying business needs and bridging the gap between functional groups and technology to foster targeted and innovative IT project development. Well respected by peers through demonstrating passion for technology and performance improvement. Extensive practical knowledge of complex systems builds, network design, business continuity, and cloud security.

Be the first to comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.