Category: Hyper-V

Hyper-V 2016 Linux Ubuntu PXE Network Boot Error

If you’re like me, you want to run Linux on your Hyper-V 2016 host, in my case I am attempting to run a Linux Ubuntu 16.04.1. Booting from an ISO, I kept getting the same error over and over. “PXE Network Boot using IPv4 ( ESC to cancel ) Performing DHCP Negotiation….“. After realizing it wasn’t the ISO media. It wasn’t the size of the VHDX. It wasn’t the memory/vCPU or vNIC configuration. It wasn’t even due to the fact it was a Generation 1 or Generation 2 VM…. It was Secure Boot function.

1 2

Solution

  1. Stop the VM
  2. Go to its Settings
  3. Within Hardware > Select Security > Disable/UncheckEnable Secure Boot” > Start your machine back up!

3

Yay!

Advertisements

How to upload Custom Images to Microsoft Azure using PowerShell

In this post, I am going to show how to upload a custom image used in Windows Hyper-V (2016) to Azure cloud. I will be using a combination of the UI in Hyper-V and PowerShell in Azure Resource Manager. I will be working with Azure Resource Manager (ARM) and with Hyper-V 2016 with a custom image of Windows Server 2008 R2 SP1.

Okay, let’s get started.

Prepare On-Premises Virtual Machine Image

First, we need an image to work with. As mentioned, I am using a Windows Server 2008 R2 SP1 (yes, 2008 — needed it for a customer). The VM is Generation 1, which is not only a requirement for Windows 2008, but also a requirement for Azure, as it currently does not support Generation 2 VMs. See HERE to read more on preparing a Windows VHD.

Next, we need to install Hyper-V role on the VM. Since this is a nested VM, we will first need to enable nested-virtualization on the Hyper 2016 box. See a previous post on how to go about this HERE. Once that is complete, go ahead and install the Hyper-V role.

Next, we now need to SysPrep our VM. From an Administrative command prompt, navigate to %windir%\system32\sysprep and then execute the command “sysprep.exe”. Here, we will be using OOBE and enabling “Generalize”, also “Shutdown” the VM once SysPrep completes.

Once the VM is SysPrep’ed, we now need to compact the VHDx (remember Hyper-V 2016 here) and also will need to convert the VHDx to a VHD. This is due to the limitation of Azure at the moment, as it only supports Gen1 VMs and VHD’s.

Go into Hyper-V and within the VM properties, edit the Virtual hard disk. Then we will need to compact the virtual hard disk. Go ahead and do that..

Great, now we need to convert the VHDx to a VHD. Time for PowerShell!

Convert-VHD –Path “<source VHDX path>" –DestinationPath "<destination VHD path>" -VHDType Fixed -Verbose


Let this run (I let it go over night.. it was getting late =) )

Great, now we are ready to move on to Azure and more PowerShell.

Build Azure Container and Upload Image to Azure

First, we need to download  and install the latest AzureRM bits module locally to the Hyper-V box (if you have done this.. jump down a few lines…)

Install-Module AzureRM -Force

Next, since there was a recent update to the AzureRm module, I now need to update the module path location.

$env:PSModulePath = $env:PSModulePath + "; C:\Program Files\WindowsPowerShell\Modules"

Next, we will need to import the AzureRm module.

Import-Module AzureRM -Force

Next, we’ll need to log-in into our Azure account, and specify the subscription to want to work with. In my case, there are multiple Azure subscriptions tied to my email.

Login-AzureRmAccount
Get-AzureRmSubscription
#select the subsciption you will be working with -- if you have one, you can skip this line
Select-AzureRmSubscription -SubscriptionId "<ID>"

Next, we will create a resource group and storage account, and bind the account the group.

New-AzureRmResourceGroup -Name "ResourceGroupName" -Location "Canada East"
New-AzureRmStorageAccount -ResourceGroupName "ResourceGroupName" -Name "StorageAccountName" -Location "Canada East" -SkuName "Standard_LRS" -Kind "Storage"

If you want to change the storage type, to let’s say Geo-redundant, here are the other types of storage:

Valid values for -SkuName are:

  • Standard_LRS – Locally redundant storage.
  • Standard_ZRS – Zone redundant storage.
  • Standard_GRS – Geo redundant storage.
  • Standard_RAGRS – Read access geo redundant storage.
  • Premium_LRS – Premium locally redundant storage.

Now, we need to create a Container and grab the URL needed to upload our image. I did this through the Azure Resource Manager (ARM) Portal since I couldn’t figure out the PowerShell cmdlet (Get-AzureStorageBlob) — if you can get this to work, please let me know!

You can get the URL from the Web UI when you go into the Storage Account >> Blobs >> Container (in my case, I called it “VHD”) >> Properties.

Now we are ready to upload our image/VHD to Azure! For me this took about 2 hours, uploading a 80GB file @ 9-10MBs.

$rgName = "ResourceGroupName"
$AzureVHDURL = "URL"
$LocalVHDPath = "LocalPathtoVHD"
Add-AzureRmVhd -ResourceGroupName $rgName -Destination $AzureVHDURL -LocalFilePath $LocalVHDPath

Great, now we just need to register the VHD disk to the Gallery, and we can begin creating machines based off our image that is now in the cloud! — Another post! 🙂

Step-by-Step – Installing System Center Virtual Machine Manager (SCVMM) 2016

Finally got some time to installing and play around with SCVMM (System Center Virtual Machine Manager) 2016 this weekend. Along with the installation and configuration, I figured to snapshot the installation and configuration. Below are the steps I have taken to get a PoC (Proof of Concept) of SCVMM installed.

For this installation, I will be installing SCVMM 2016 on Windows Server 2016 (with UI) and on a virtualized machine within a Hyper-V (2016) environment. There is no fancy storage here, so I will omit that for this configuration/blog post.

Prerequisites, you will need some service accounts:

  • SCVMM Service Account
  • SCVMM Administrator Account
  • SCVMM Administrator Group
  • SQL Service Account

You can use PowerShell to quickly create the accounts, see here:

#create scvmm service accounts
New-ADUser -Name "SCVMM_SA" -GivenName SCVMM -Surname SA -SamAccountName scvmm_sa -UserPrincipalName scvmm_sa@ravilocal.com; -AccountPassword (ConvertTo-SecureString “Passw0rd” -AsPlainText -Force) -PassThru | Enable-ADAccount
New-ADUser -Name "SCVMM_ADMIN" -GivenName SCVMM -Surname ADMIN -SamAccountName scvmm_admin -UserPrincipalName scvmm_admin@ravilocal.com; -AccountPassword (ConvertTo-SecureString “Passw0rd” -AsPlainText -Force) -PassThru | Enable-ADAccount

#create scvmm admins security group, add scvmm_sa and scvmm_admin to the group
New-ADGroup SCVMM_ADMINS -GroupScope Global -GroupCategory Security
Add-ADGroupMember SCVMM_ADMINS -Members SCVMM_SA
Add-ADGroupMember SCVMM_ADMINS -Members SCVMM_ADMIN

#create sql sa account
New-ADUser -Name "SQL_SA" -GivenName SQL -Surname SA -SamAccountName sql_sa -UserPrincipalName sql_sa@ravilocal.com -AccountPassword (ConvertTo-SecureString “Passw0rd” -AsPlainText -Force) -PassThru | Enable-ADAccount

Once you have done this, I then added the SCVMM accounts to the Local Administrators group on the server.

Next, you will need to prep you server with the Windows Automated Deployment Kit (ADK) and SQL Command Line Utilities.

Download the Windows ADK for Windows 10.

You will need to install the Deployment Tools and Windows Preinstallation Environment  (Windows PE) features.

0

Then I downloaded the SQL Server Command Line Utilities 11 along with ODBC Driver 11 for SQL Server. Both of these downloads can be found below.

Once complete, I then installed a new SQL instance on my SQL 2016 SP1 machine, called it “SCVMM16“.

After that, then I was rebooted my SCVMM server, and I was ready to start the SCVMM 2016 install.

Executing the Setup.exe as the Local Administrator

1

2

3

Connect to a SQL instance. If you need to know the SCVMM SQL requirements, go HERE.

4

Since this is a PoC, and not being prepped for a Production environment, I can go ahead and skip the Distributed Key Management, although this is required and recommended if you’re deploying in a HA/Production environment.

5

Double check the default ports are open for the install, or update the ports as needed to correspond to your environment.

6

Since this a fresh install, and I did not setup an external SAN storage, I will keep this as default, and configure later.

7

Double check and confirm the summary details before proceeding — no going back after this….

8

Once you’re ready, go ahead and hit Install. For me, the install took about 15 minutes.. Good time for a walk and fresh air. 🙂

9

 

Sweet!! Now we are ready to roll.

Next steps (I will do that next and blog soon…)

  • Configure SCVMM 2016
    • Deploy the SCVMM agent to our Hyper-V host(s)
    • Configure the Library Share/PXE
    • Configure the Fabric/Network/etc.,
  • Install Update Rollup 2 (UR2)

Until then, happy SCVMM’ing!

Step-by-Step: Setup and Configure Azure Site Recovery (ASR) with Windows Server 2016 Hyper-V using ARM

Not too long ago, Microsoft announced the support of Windows 2016 and Azure Site Recovery (ASR). Microsoft’s announcement can be found HERE.

With that said, I decided to setup ASR with my Hyper-V 2016 environment. Rather than the typical blog posts (screenshots etc.,) I decided to create a step-by-step video that demonstrates how to setup ASR with Windows Server 2016 and Hyper-V. That video can be found HERE at Channel 9.

In addition this post is a series of blog posts for Azure Site Recovery (ASR).

Step-by-Step: Setup and Configure Azure Site Recovery (ASR) for On-Premises Hyper-V Host with Azure Resource Manager (ARM)

This post is a series of blog posts for Azure Site Recovery (ASR).

Here is a step by step walk-through on how to go about setting up and configuring ASR (Azure Site Recovery) and backing up your On-Premises Virtual Machines (VMs) with Azure Resource Manager (ARM).

First things, first, Azure’s Recovery Service Vault is a unified vault/resource that allows you to manage your backup and data disaster recovery needs within Azure. For example, if you are hosting your VMs on-premises you can create a link between your on-prem site and Azure to allow your VMs to be backed-up into Azure. This is regardless of your hypervisor, it can be either ESX or Hyper-V, either will work. However for the interest of this blog post, I will be setting up ASR for a Hyper-V 2012R2 host.



Configuring Azure

Step 1: Create a Recovery Services Vault

Within Azure Resource Manager (ARM), if we select New, within the Marketplace, select Monitoring + management, then select Backup and Site Recovery (OMS) within the featured apps. Of course if this is no longer present, just search for it within the marketplace.

1

Next we will now need to create our vault.

Give it a meaningful name, and you can either create a new Resource Group, or use an existing. I opted with existing, as I will (another post) next setup a Site-to-Site ASR.

2

Give this a few seconds, maybe minutes to do its thing…

Great, now our Vault is up and ready to go!

3

Step 2: Choose your Protection Goal(s)

Click Settings > Site Recovery (Under Getting Stated) > Step 1: Prepare Infrastructure > Protection Goal > And specify the following > Click OK:

  • Replicating to: Azure
  • Machines Virtualized: Yes, with Hyper-V
  • Using SCVMM (Virtual Machine Manager): No

4

Step 3: Setup the Source Environment

Next, we will now need to Prepare our source give our Hyper-V site a name, “Ravi-OnPrem” makes sense here, but give it something meaningful.

5

6

Now we need to download the ASR Provider Installer, along with the Vault Registration Key.

set-source3

Step 4:  Install and Configure the ASR Provider on Hyper-V Host

1

2

3

4

5

This Hyper-V host is not behind any Proxy…

6

If we go back to Azure, we can now see our Hyper-V host populated.

7

Step 5: Create a Replication Policy

Within our Vault properties > Settings > Manage: Site Recovery Infrastructure > For Hyper-V Sites: Replication Policies > +Replication Policies

8

Step 6: Associate Hyper-V Site(s)

Next we will need to Associate our Hyper-V site:

9

10

Great! Now we can continue on with Step 3 (Target Environment) of Step 1 (Preparing Infrastructure).

Step 7: Create a Storage Account + Virtual Network

8

9

Within the Replication, we have a few options here. I left mine as default (GRS) Geo-Redundant.

Next, we need to create a Target Virtual Network:

11

Now we can go ahead and setup the replication settings:

Step 8: Setup Replication Settings

12

Since we create the Replication Policy beforehand, this auto-filled. Next we need to do some Capacity Planning. Since this is simply a walk-through example, I elected to skip this, but for a real-production environment, I would highly recommend doing this.

Here is a link to Microsoft’s Capacity Planner for Hyper-V Replica.

14

Hit OK, and now we are ready to to move on to Step 2 (Replication Application)

15

16

This all should have populated since we created our Storage account and Virtual Network just earlier… If not, add them.

Now Azure should have connected with our Hyper-V host, we can now see our VMs within our Hyper-V host. Here we now need to select which machines we will want to include within ASR. For simplicity and variety, I am going to select a domain controller and a Linux machine.

17

Now we need to configure the VMs properties:

18

Once we are good, we can go ahead and apply the Replication Policy to our VMs.

19

Once satisfied, go ahead and hit “Enable Replication“.

20

 

Lastly, Step 3, we now need to complete creating our Recovery Plan:

Step 9: Create Recovery Plan

21

Great! All done? Before we say all done, let’s go back to our Hyper-V host, and configure the Network/Throttling bandwidth.

Step 10: Network/Throttle Bandwidth

My Hyper-V host is not equipped with a GUI as I am using Windows 2012R2 Minimal Server, so navigate here to launch the Microsoft Azure Backup Agent, “C:\Program Files\Microsoft Azure Recovery Services Agent\bin\“. Launch, “wabadmin“.

23

In the Actions pane, select “Change Properties” >> Select the Throttling tab.

24

Change these settings as to your needs. I wanted to increase my non-work hours to 4MB, but looks like 1MB is the max.

Great! Since we already hit, enable replication, this process should have already started… Let’s go back to Azure:

If we take a look at the Vault > Settings > Protected Items > Replicated Items 

25

Once these VMs are 100% Synchronized, the next steps will be to simulate a fail over, both Test and Planned.

26