Part 2: Azure Stack Development Kit Deployment Guide

Previous Post in Series:  Part 1:  Azure Stack – A “Quick” Overview

Hello again folks. A while ago now, I created an end to end guide for deploying the Azure Stack TP3 single node POC. Now we’ve got the ASDK, it’s time to run through another deployment and see what’s changed.

Here’s a list of what we’ll  be covering

If you’re deploying Azure Stack for the first time, have a look at this Prerequisites section before continuing.

 

Sign up for and Download Azure Stack Dev Kit

The process for this is almost identical to what it was in TP3, you can find the instructions HERE, the screenshots will look a little different but close enough that you can follow them without issue.

When you’ve downloaded the required files and extracted the CloudBuilder.vhdx file, copy it to the root of the C: drive.

Download ASDK Support Files

The PowerShell has been modified slightly since TP3 as we’re no longer downloading multiple files here, and instead we’re getting a single script called “asdk-installer.ps1”

Launch an elevated PowerShell ISE console, paste the following code into the editor and run it.

# Variables
$Uri = 'https://raw.githubusercontent.com/Azure/AzureStack-Tools/master/Deployment/asdk-installer.ps1'
$LocalPath = 'C:\AzureStack_Installer'

# Create folder
New-Item $LocalPath -Type directory

# Download file
Invoke-WebRequest $Uri -OutFile ($LocalPath + '\' + 'asdk-installer.ps1')
cd $LocalPath

 

Deploy Azure Stack Dev Kit

Prepare and Reboot into CloudBuilder VHDX

As per the prerequisites section, the ASDK only supports a single NIC, so you should only have one connected before continuing.

Although not strictly required until we reboot into the CloudBuilder VHDX, disabling the unused NICs now will make one of the upcoming steps a little cleaner.

Launch an elevated PowerShell console and paste in the following:

Get-NetAdapter | ? Status -ne "Up" | Disable-NetAdapter -Confirm:$false

In TP3, here we’d run a script called “PrepareBootFromVHD.ps1” to boot into the CloudBuilder.vhdx…that’s been changed. Now when we run “asdk-installer.ps1” we’re presented with a sexy new UI 🙂

Launch an elevated PowerShell console, and run the “asdk-installer.ps1” script you downloaded earlier (you’re in the right directory).

Click “Prepare Environment”.

clip_image001

Click “Browse” and select the CloudBuilder.vhdx file you downloaded above, it should already be in C:\ if you’ve been following these instructions.

Now click “Next”.

clip_image002

Enter and confirm a password for the Azure Stack local administrator account.

NOTE:  You’ll use this password to sign in with when the server reboots into the CloudBuilder.vhdx

Enter a name for the Azure Stack host

Change the time zone as required, the default is “(UTC-08:00) Pacific Time (US & Canada)”

If you’re not using DHCP (like me), place a tick in “Static IP configuration” and click “Next”

clip_image003

Assuming you followed the instructions above to disable all unused NICs, only one NIC should show any configuration on this screen, confirm the expected NIC is the only one showing as “Connected” and click “Next”

clip_image004

Confirm the IP information is correct and click “Next”

clip_image005

The Azure Stack preparation will now kick off, once completed, click “Next” and “Reboot now” to boot into the CloudBuilder VHDX.

clip_image006

clip_image007

 

Once your server has rebooted, log in with the administrator credentials you set earlier.

Again, we’ll want to disable all unused NICs, so launch an elevated PowerShell console and paste in the following code:

Get-NetAdapter | ? Status -ne "Up" | Disable-NetAdapter -Confirm:$false

Change Time Zone

On TP3, I found that the App Service installer failed unless I’d set the time zone to “(UTC) Coordinated Universal Time”, this no longer seem to be the case, however you can still use the instructions HERE to change the ADSK infrastructure VMs as desired.

Deploy ASDK

Again, we’ll be making use of the “asdk-installer.ps1” script from earlier, so let’s download it again.

Launch an elevated PowerShell ISE console, paste the following code into the editor and run it:

# Variables
$Uri = 'https://raw.githubusercontent.com/Azure/AzureStack-Tools/master/Deployment/asdk-installer.ps1'
$LocalPath = 'C:\AzureStack_Installer'

# Create folder
New-Item $LocalPath -Type directory

# Download file
Invoke-WebRequest $Uri -OutFile ($LocalPath + '\' + 'asdk-installer.ps1')
cd $LocalPath

As with before, the process for deployment of ASDK vs TP3 is beautiful, so let’s get on with it.

Launch “asdk-installer.ps1” from an elevated PowerShell console and select “Install” from the resultant menu.

clip_image008

NOTE:  This guide assumes you’ll be deploying the ASDK in a connected scenario using Azure Active Directory.

For Azure Active Directory, select “Azure Cloud” from the “Type” drop-down menu.

In the “AAD Directory” box, enter the name of your AAD directory, this will likely be directoryname.onmicrosoft.com, unless yours has a custom name, then it’s likely your company domain.

In the “Password” box, enter the local administrator password you just logged onto the server with.

Now click “Next”

clip_image009

Assuming you’ve been following this guide to the letter, only one NIC should show as “Connected” here. Confirm this is the case and click “Next”.

clip_image010

As mentioned before, I’m using static IP assignment on this deployment so will need to manually enter the IP information for my BGPNAT VM.

Either click “DHCP”, or click “Static” and populate with an IP and Gateway for the BGPNAT VM.

Enter an IP for a DNS forwarder for the DC VM that’s deployed as part of ASDK.

Optionally, enter a time server. I also enter one here due to the issues I’ve had in the past using time.windows.com.

Now click “Next”

clip_image011

The deployment will now run a few checks to make sure everything in bonza!

Assuming everything checks out, click “Next” and “Deploy”

clip_image012

clip_image013

Deployment will take a good long while, so go do something else and come back later 🙂

All going well, you should eventually see output similar to the screenshot below:

clip_image014

Now that we’ve got a successful deployment, there are few things well want to do before we consider it complete.

 

Reset Password Expiration to 180 days

I’ve covered already in my TP3 guide and from what I’ve seen, the process hasn’t changed. You can find instructions HERE.

NOTE:  I did have to run this step twice for it to take effect on one of my 3 deployments, that’s not expected behaviour though and you may not experience the same.

 

Register Azure Stack with Azure Subscription

Although the following section isn’t a requirement, it’s very likely something you’ll want to do. We’re going to register our ADSK deployment with an Azure subscription as this will allow us to deploy items from the Azure marketplace (marketplace syndication).

NOTE:  Keep in mind I’m using Azure Active Directory here and the process is slightly different if you’re using ADFS.

First things first, launch an elevated PowerShell ISE console. Leave this console open for the foreseeable as it’ll save you having to repeat any of these steps while completing the next few tasks.

Let’s mark the PowerShell Gallery as trusted as we’re about to download a couple of modules. Paste the following code into ISE and run it.

Set-PSRepository `
-Name "PSGallery" `
-InstallationPolicy Trusted

As we’re about to install some Azure PowerShell modules with a specific version, let’s remove any old ones before continuing.

Paste the following code into ISE and run it.

Get-Module -ListAvailable | where-Object {$_.Name -like "Azure*"} | Uninstall-Module

Paste the code below into ISE and run it to do the following:

  • Install the AzureRM.Bootstrapper module
  • Install the 2017-03-0-profile version of the AzureRM modules for Compute, Storage, Network, Key Vault etc.
  • Install Azure Stack specific PowerShell modules
# Install the AzureRM.Bootstrapper module. Select Yes when prompted to install NuGet
Install-Module -Name AzureRm.BootStrapper

# Install and import the API Version Profile required by Azure Stack into the current PowerShell session.
Use-AzureRmProfile -Profile 2017-03-09-profile -Force
Install-Module -Name AzureStack -RequiredVersion 1.2.10

You can check you have successfully installed the required modules by running the following command:

Get-Module -ListAvailable | ? Name -Like "Azure*"

 

Download Azure Stack Tools

Now we’re going to download the Azure Stack tools from GitHub, these include some PowerShell modules we’ll be using later.

Paste the following code into ISE and run it.

NOTE:   If you change the download directory here, take care NOT to download it to the C:\Windows\System32 directory.

# Change directory to the root directory
cd \

# Download the tools archive
invoke-webrequest `
"https://github.com/Azure/AzureStack-Tools/archive/master.zip" `
-OutFile master.zip

# Expand the downloaded files
expand-archive master.zip `
-DestinationPath . `
-Force

# Change to the tools directory
cd AzureStack-Tools-master

 

Set up Marketplace Syndication

We’ll start by importing the PowerShell connect module.

You should still have your PowerShell ISE console open, paste the following code in and run it.

Set-ExecutionPolicy RemoteSigned
Import-Module .\Connect\AzureStack.Connect.psm1

Now let’s register the Azure environment, run the code below.

Add-AzureRMEnvironment `
-Name "AzureStackAdmin" `
-ArmEndpoint "https://adminmanagement.local.azurestack.external"

Now set the GraphEndPointResourceId.

Set-AzureRmEnvironment `
-Name "AzureStackAdmin" `
-GraphAudience "https://graph.windows.net/"

Now we’ll need to grab the GUID of the AAD tenant we used when deploying Azure Stack.

Paste the following code into ISE and run it:

$TenantID = Get-AzsDirectoryTenantId `
-AADTenantName "myDirectoryTenantName.onmicrosoft.com" `
-EnvironmentName "AzureStackAdmin"

With all that taken care of, let’s log into our Azure Stack environment.

Login-AzureRmAccount `
-EnvironmentName "AzureStackAdmin" `
-TenantId $TenantID

As we’ve been operating in the cloud administrator’s subscription we can skip this step. If you’re working with any newly created user subscriptions though, the foundation resource providers aren’t registered by default and will need to be done manually.

Paste the following code into ISE and run it (if required). Running it against our cloud administrator subscription won’t do any harm (in case you are curious of the codes output):

foreach($s in (Get-AzureRmSubscription)) {
Select-AzureRmSubscription -SubscriptionId $s.SubscriptionId | Out-Null
Write-Progress $($s.SubscriptionId + " : " + $s.SubscriptionName)
Get-AzureRmResourceProvider -ListAvailable | Register-AzureRmResourceProvider -Force
}

NOTE:  Remember! Keep ISE open for the time being.

 

Run Azure Registration Script

Now with all that done, we can FINALLY register our Azure Stack deployment with our Azure subscription.

OK, let’s start by logging into the Azure Stack admin portal: https://adminportal.local.azurestack.external/

Copy the “RegisterWithAzure.ps1” script from “C:\AzureStack-Tools-master\Registration” to “C:\Temp\”

Modify the following code as required, paste it into ISE and run it:

The following table details expected values for the command

ParameterDescription
AzureSubscriptionIdThis is subscription ID you want to link your Azure Stack deployment to. You can get it by logging into https://portal.azure.com, clicking on "Subscriptions" and copying the relevant value under "SUBSCRIPTION ID" See "Diagram 1" below
AzureDirectoryTenantNameThe value should be your AAD Directory name.onmicrosoft.com. In my experience, this is generally companyname.onmicrosoft.com.
AzureAccountIdThis needs to be a user that has the "Owner" role on the above subscription. Again, see "MY ROLE" on "Diagram 1" below.
C:\Temp\RegisterWithAzure.ps1 -AzureSubscriptionId YourID -AzureDirectoryTenantName YourDirectory -azureAccountId YourAccountName

**Diagram 1**

clip_image015

The command will take a while to complete. Once it finishes, refresh your portal webpage and navigate to:

“Marketplace Management” and click on “Add from Azure”, you should see something similar to the screenshot below:

clip_image016

Congratulations, you can now deploy available Azure resources on your Azure Stack deployment.

 

Create and Upload Server 2016 Default Image to Gallery

I went over this step in detail in my TP3 guide HERE, I’ll go through it again quickly here as the PowerShell has changed slightly.

Close any PowerShell consoles you have open and launch a fresh elevated PowerShell ISE console.

Step 1

Firstly, we’ll want to import a couple of PowerShell modules, run the following code from PowerShell ISE console you opened above.

Import-Module C:\AzureStack-Tools-master\Connect\AzureStack.Connect.psm1
Import-Module C:\AzureStack-Tools-master\ComputeAdmin\AzureStack.ComputeAdmin.psm1

Step 2

Register your Azure Rm environment

Add-AzureRMEnvironment `
-Name "AzureStackAdmin" `
-ArmEndpoint "https://adminmanagement.local.azurestack.external"

Step3

Get the GUID of the AAD tenant we used when deploying Azure Stack.

$TenantID = Get-AzsDirectoryTenantId `
-AADTenantName "myDirectoryTenantName.onmicrosoft.com" `
-EnvironmentName AzureStackAdmin

Step 4

Log into your Azure Stack environment

Login-AzureRmAccount `
-EnvironmentName "AzureStackAdmin" `
-TenantId $TenantID

If you already have your own Server 2016 ISO you can use that. If not, you can download an evaluation HERE. When prompted, select the ISO version of the download and choose a save location.

Now update the $ISOPath variable with your ISO save location from above and run the following code.

$ISOPath = "Fully_Qualified_Path_to_ISO"

# Add a Windows Server 2016 Evaluation VM Image.
New-AzsServer2016VMImage `
-ISOPath $ISOPath

The creation and upload process will take a while and this is what success looks like 🙂

clip_image017

OK that about covers it for this guide, my SQL and MySQL as PaaS guides have now been updated for the ASDK, as has my App Service guide. See you in the next post (not decided what that’ll be yet)

2 Replies to “Part 2: Azure Stack Development Kit Deployment Guide”

  1. Great Post . Any idea on how to register with Azure Marketplace when deployed using ADFS !? I cant seem to find any information on that even in Microsoft documentation.

    Thanks.

    1. Hi Saadallah, thanks for the feedback 🙂

      I don’t think it’s currently possible to register with the marketplace if you deployed using ADFS, although the documentation doesn’t explicitly call that out, I’m getting that from the following:

      “For Azure Active Directory deployments, you can register Azure Stack with Azure to download marketplace items from Azure and to set up commerce data reporting back to Microsoft.”

      https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-register

Leave a Reply

Your email address will not be published. Required fields are marked *