Skip to main content

Setting up IoT Edge Gateway on Hyper-V

Set up the Hyper-V Manager on your Windows Machine

Connect to the Virtual Machines

  1. Start the VM.

Configure Proxy

  1. On the Utility VM, open Internet Explorer.
  2. Click the gear icon in the top right corner.
  3. Navigate to Internet Options > Connections > LAN Settings.
  4. Under Proxy Server, enable the Use a proxy server… option.
  5. Fill in the proxy address and the port.
  6. Enable the checkbox Bypass proxy server for local addresses.
  7. Click Ok.

Install Notepad++

  1. While still on Internet Explorer, download and install Notepad++.

Install Hyper-V Manager

  1. On the Utility VM, right-click the Windows icon.
  2. Open Apps and Features (First option).
  3. Scroll to the bottom.
  4. Open Programs and Features under the Related settings section.
  5. On the left panel, open Turn Windows features on or off.
  6. Open the Hyper-V tree and enable the checkbox Hyper-V Management Tools.
  7. Hyper-V Manager will now be installed.

Add the Hypervisor to the hosts file

  1. Still on the Utility VM, open file explorer.
  2. Navigate to C:\Windows\System32\drivers\etc.
  3. Right-click the HOSTS file and open it with Notepad++.
  4. On the bottom line, add the following [IP of hypervisor] [Name of Hypervisor].
  5. Save the file.
  6. Click Yes to open as an administrator.
  7. Save again.
note

The name of the Hypervisor can be obtained by typing hostname in the cmd line.

Configure the local group policy

  1. Still on the Utility VM, open Settings.
  2. Search for Edit Group Policy.
  3. Under Console Root\Local Computer Policy\Computer Configuration\Administrative Templates\System\Credentials Delegation, enable the Allow delegating fresh credentials with NTLM-only server authentication.
  4. Add the server to the list wsman/{HOSTNAME}.
  5. Click Ok, Apply, and Ok again.

Set up winrm

  1. On the Hypervisor, execute the following command: winrm quickconfig.
  2. Press y.

Connect Hyper-V Manager to the Hypervisor

  1. On the Utility VM, right-click the Hyper-V Manager in the left panel.
  2. Click Connect to Server….
  3. Select Another Computer.
  4. Fill in the Hypervisor’s device name.
  5. Enable the checkbox Connect as another user.
  6. Click Set User….
  7. Fill in the username D30\Administrator.
  8. Fill in the default Hypervisor password.
  9. Click Ok.

Set up the Virtual Appliance for Hyper-V and Virtual Box

This article will explain how you set up the Virtual Appliance in an existing VM.

Pre-requisites:

  • Hypervisor set up in the Utility VM.
  • IoTHub enrollmend created in the DPS.

Get the VM Ready

  1. Start the VM.

  2. Log in with the following credentials: ubuntu, ubuntu.

  3. To set a temporary static IP, edit the Netplan file by executing the following command:

    sudo nano /etc/netplan/50-cloud-init.yaml
  4. Fill in the variables using the IP setting of your current plant. Make sure you use the same IP as the VM you stopped in the above steps.

    note

    The first address is the PRD or ACC VM address, not the one of the Hypervisor. The gateway and the DNS server names can be found by typing 'ipconfig /all' in the Hypervisor command line.

VM Setup

  1. Save with ctrl+x > y > enter.

  2. To set the IP, execute the following command:

    sudo netplan apply
  3. Connect to the virtual machine via PowerShell on the Utility VM, execute the following command:

    ssh ubuntu@[IP of VM]
  4. Log in with the Ubuntu credentials again.

    note

    It's easier to connect to the virtual machine via PowerShell as it allows easy copying and pasting.

Deploy the Virtual Appliance

  1. While connected to the Linux VM you just created via SSH on the Utility VM, execute the Sysprep script:

    sudo ./sysprep.sh
  2. Fill in the fields as requested:

VM Setup

FieldDescriptionRequired / Optional
HostnameName of VMRequired
IDScopeCan be copied from the Azure IoT Hub Device Provisioning ServiceRequired
DeviceIDSame as Hostname, which is the name of VMRequired
Symmetric keyCan be copied from the individual enrollment in DPSRequired
Default UsernameYour default usernameRequired
Public SSH keyPublic SSH key, if set upOptional
Static IPYRequired
Static IPv4 AddressThe assigned IP address of the original VMRequired
Subnet MaskThe subnet mask of the network. Can be found by typing ipconfig /all in the Hypervisor cmd line. Make sure to use the prefix notation.Required
GatewayCan be found by typing ipconfig /all in the Hypervisor cmd line.Required
NameserversThe DNS server names can be found by typing ipconfig /all in the Hypervisor cmd line.Required
Proxy addressProxy server addressOptional
  1. The VM will now restart and install the required applications and settings. Wait until the machine has restarted a second time.

  2. You can now log in with the username you set over SSH. Upon first login, you will have to specify a new password as no password is set. You will be logged out as the new password is set, but due to certificate login, you no longer need the password to log in.