Hello everyone,

You may have seen the announcement Windows Server 2019 preview, recently released.

After the installation Azure Stack Development Kit (ASDK) or Azure Stack Integrated Systems, we need to add the default Windows Server or Linux Image. If you enabled Azure Stack in connected mode and register it with a public Azure, you can download it Azure Marketplaces (known as Marketplace Syndication). Learn more about this process check the previous post below.

Because Windows Server 2019 has just been released in preview, the image is not yet available in the public Azure, and we cannot upload it to the Azure Stack at the time of writing.

In this post, I’ll show you how to add a custom Windows Server 2019 image of the Azure stack with PowerShell.

Suppose you have already downloaded Azure Stack PowerShell and the necessary tools article above.

To create a custom Windows Server 2019 image, follow these steps:

  1. We need to prepare the Windows Server 2019 image (hard disk) inside VHD format and NO VHDX form. Note that Azure Stack does not support dynamic disks.
  2. Download the Windows Server 2019 ISO preview from here.
  3. charge Convert WindowsImage.ps1 manuscript here.
  4. You can create an image by creating the following script.
    # Load (aka dot-source) the Function 
    . .Convert-WindowsImage.ps1 
    
    # Prepare all the variables
    $ConvertWindowsImageParam = @{  
        SourcePath          = "D:ASDKWindows_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 a Windows Server 2019 image to the Azure Stack Marketplace, follow these steps:

  1. Bring AzureStack Connect and ComputeAdmin modules:
    # Import the Connect and ComputeAdmin Modules
    Set-Location C:AzureStack-Tools-masterConnect
    Import-Module .AzureStack.Connect.psm1 -Verbose
    
    Set-Location C:AzureStack-Tools-masterComputeAdmin
    Import-Module .AzureStack.ComputeAdmin.psm1 -Verbose
  2. To log in to the Azure Stack environment, run 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
  3. To add a custom virtual machine image for Windows Server 2019, run the following command:
    # Add Windows Server 2019 Image
     Add-AzsVMImage `
     -Publisher "Microsoft" `
     -Offer "WindowsServer" `
     -Sku "Datacenter2019" `
     -Version "17623.0.0" `
     -OsType Windows `
     -OSDiskLocalPath "E:Temp17623_WindowsServer2019_Datacenter_en-US.vhd"

    And this process takes a little time. In this example, it took a little over 6 minutes.

    Behind the scenes, the following happens: First, authenticate to the Azure Stack environment, upload the local VHD image to the newly created temporary storage account, and then add the VM image to the VM image archive, and finally create a Marketplace target. When the image is successfully added, you will receive a message similar to the following: Add a Windows Server 2019 image to AzureStack #AzureStackDevKit # WindowsServer2019 3

To make sure the image was added successfully, go to the portal Market townand check that the virtual machine image is available Calculate category.

Add a Windows Server 2019 image to AzureStack #AzureStackDevKit # WindowsServer2019 4

The final step is to implement the new image and make sure it works successfully. Go to the portal at New, Click Calculate, select the image you just added and Create new virtual machine.

Add a Windows Server 2019 image to AzureStack #AzureStackDevKit # WindowsServer2019 5

Happy Windows Server 2019 preview evaluation in Azure Stack!

Add a Windows Server 2019 image to AzureStack #AzureStackDevKit # WindowsServer2019 6

__
Thanks for locking my blog.

If you have any questions or feedback, please leave a comment.

-Charbel Nemnom-

LEAVE A REPLY

Please enter your comment!
Please enter your name here