You dont have javascript enabled! Please enable it! How To Add Windows Server 2016 Image To #AzureStack #AzureStackDevKit #WindowsServer - CHARBEL NEMNOM - MVP | MCT | CCSP | CISM - Cloud & CyberSecurity

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

3 Min. Read

Hello folks,

After installing Azure Stack Development Kit (ASDK) or Azure Stack Integrated Systems, we need to add a default Windows Server 2016 or Linux Image. But before doing so, we have to complete a couple of tasks.

In this blog post, I will show you how to set up PowerShell for Azure Stack, then register Azure Stack with Azure subscription, and finally add a Windows Server 2016 image.

Set up PowerShell for Azure Stack

Login to Azure Stack Development Kit. Open an elevated PowerShell ISE session, and then run the following script:

# Set Execution & Repository policies
$ResetExPol = Get-ExecutionPolicy
Set-ExecutionPolicy Unrestricted  -force
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
### Install and Import AzureStack Modules 1.2.11 & Tools
Install-Module -Name  AzureRm.BootStrapper
Use-AzureRmProfile -Profile 2017-03-09-profile -Force
Install-Module -Name  AzureStack -RequiredVersion  1.2.11
Import-Module -Name  AzureStack -RequiredVersion  1.2.11
cd c:\

invoke-webrequest -OutFile
expand-archive -DestinationPath . -Force
cd AzureStack-Tools-master
Import-Module .\Connect\AzureStack.Connect.psm1
Import-Module .\ComputeAdmin\AzureStack.ComputeAdmin.psm1

### Reset Execution Policy back to default
Set-ExecutionPolicy $ResetExPol -Force

### Specify Azure Active Directory tenant name.
$TenantName = "" # Specify Azure Active Directory Name

### For Azure Stack development kit, this value is set to https://adminmanagement.local.azurestack.external.
$ArmEndpoint = "https://adminmanagement.local.azurestack.external"

### For Azure Stack development kit, this value is adminvault.local.azurestack.external 
$KeyvaultDnsSuffix = “adminvault.local.azurestack.external”

### Register an AzureRM environment that targets your Azure Stack instance
Add-AzureRMEnvironment -Name "AzureStackAdmin" -ArmEndpoint $ArmEndpoint

### Get the Active Directory tenantId that is used to deploy Azure Stack
$TenantID = Get-AzsDirectoryTenantId -AADTenantName $TenantName -EnvironmentName "AzureStackAdmin"

### Sign in to Azure Stack environment
Login-AzureRmAccount -EnvironmentName "AzureStackAdmin" -TenantId $TenantID

Here’s a quick overview of what the script above is doing:

  • Set PowerShell Execution and PowerShell repository
  • Install and import AzureStack Modules version 1.2.11
  • Download and install AzureStack-Tools
  • Import Azure Stack connect and compute modules
  • Reset PowerShell Execution Policy back to default
  • Register Azure Resource Manager (AzureRM) environment with Azure Stack Instance
  • Login to Azure Stack environment

Now that you have set up PowerShell for Azure Stack, I will keep PowerShell ISE console open for the time being, we’ll be using it in the subsequent sections.

If you want to confirm that everything is working as expected, you can test the configuration by creating a test resource group by running the command below:

### Test Azure Stack Connectivity by creating a Resource Group 
New-AzureRMResourceGroup -Name "Test-ASDK-RG01" -Location Local

After the resource group is created, the Provisioning state property is set to Succeeded as shown in the next screenshot.

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

Register Azure Stack with Azure Subscription

This is step is not required, but it’s recommended because it enables you to test and download Azure marketplaces items from public Azure (known as Marketplace Syndication).

Before you start registering Azure Stack with Azure, you must have a subscription ID for an active Azure subscription.

Log into your Azure Subscription at and grab your subscription ID that you want to register with Azure Stack. You might have multiple subscriptions.

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

Once you have the subscription ID, login to the Azure Stack host computer and run the following PowerShell script to register Azure Stack with Azure.

### Register Azure Stack Resource Provider with Azure
# This step only needs to be completed once in an Azure Stack environment
Login-AzureRmAccount -EnvironmentName "AzureCloud"
Register-AzureRmResourceProvider -ProviderNamespace Microsoft.AzureStack
### Register Azure Stack Environment with Azure
# Specify Azure Active Directory Name
$AADTenantName = ""
$ASDKAdminCred = Get-Credential ("AzureStack\AzureStackAdmin")
# Specify Azure Subscription ID that you want to use
$AzureSubscriptionID = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
# This should be the IP address for the Azs-ECRS01 VM that's deployed as part of ASDK
$PrivilegedEndpoint = "" 

### Import the Register With Azure Module
cd C:\AzureStack-Tools-master\Registration
Import-Module .\RegisterWithAzure.psm1 -Verbose

### Run the Azure registration cmdlet
Add-AzsRegistration `
   -CloudAdminCredential $ASDKAdminCred `
   -AzureDirectoryTenantName $AADTenantName `
   -AzureSubscriptionId $AzureSubscriptionID `
   -PrivilegedEndpoint $PrivilegedEndpoint `
   -BillingModel Development

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

Here’s a quick overview of what the script above is doing:

  • Logs into your Azure account. You’ll be prompted for credentials, enter the credentials of a Global Administrator for your subscription
  • Registers the “Microsoft.AzureStack” resource provider with your Azure account
  • Specify the AAD Tenant Name, Azure Stack admin credentials, Azure Subscription ID and the IP address for the Privileged Endpoint VM that was deployed as part of Azure Stack
  • Import the Register With Azure Module
  • Finally, activating Azure Stack with Azure (this may take up to 10 minutes to complete)

Add Windows Server 2016 Image to Azure Stack

In the final section, we will download and add Windows Server image from Azure to Azure Stack. This step requires that you  have registered your Azure Stack instanced with Azure. If you have deployed Azure Stack in a disconnected scenario, or in scenarios with limited connectivity, the check the following article on how to add the image in offline mode by using PowerShell.

  • Log into your Azure Stack Development Kit portal at: https://adminportal.local.azurestack.external/
  • Select More services > Marketplace Management > Click on +Add from Azure. (You should now be presented with a populated Marketplace items)
  • Search for the Windows Server 2016 Datacenter – Eval image How to Add Windows Server 2016 Image to #AzureStack #AzureStackDevKit #WindowsServer 5
  • Select the image and click Download. The image download size is 40GB, so it will take some time to complete. How to Add Windows Server 2016 Image to #AzureStack #AzureStackDevKit #WindowsServer 6
  • When the download is finished successfully, you can see the image is available under Marketplace management. The image also is available under Virtual machines. How to Add Windows Server 2016 Image to #AzureStack #AzureStackDevKit #WindowsServer 7

That’s it there you have it. You can now start provisioning virtual machines… Until then, see you in the next post!

Thanks for reading!


Photo of author
About the Author
Charbel Nemnom
Charbel Nemnom is a Senior Cloud Architect with 21+ years of IT experience. As a Swiss Certified Information Security Manager (ISM), CCSP, CISM, Microsoft MVP, and MCT, he excels in optimizing mission-critical enterprise systems. His extensive practical knowledge spans complex system design, network architecture, business continuity, and cloud security, establishing him as an authoritative and trustworthy expert in the field. Charbel frequently writes about Cloud, Cybersecurity, and IT Certifications.

Download Script for VHD Evaluation for System Center Preview #SysCtr #SystemCenter

How to Recover a Deleted Storage Account in Azure Stack Hub? #AzureStack #AzureStackHub


Let us know what you think, or ask a question...