Create and Upload an OpenBSD disk image to Azure

05/24/2017

3 minutes to read

Contributors

In this article

This article shows you how to create and upload a virtual hard disk (VHD) that contains the OpenBSD operating system. After you upload it, you can use it as your own image to create a virtual machine (VM) in Azure through Azure CLI.

Azure CLI 2.0 - Make sure you have the latest Azure CLI 2.0 installed and logged in to your Azure account with az login.

OpenBSD operating system installed in a .vhd file - A supported OpenBSD operating system (6.1 version) must be installed to a virtual hard disk. Multiple tools exist to create .vhd files. For example, you can use a virtualization solution such as Hyper-V to create the .vhd file and install the operating system. For instructions about how to install and use Hyper-V, see Install Hyper-V and create a virtual machine.

Prepare OpenBSD image for Azure

On the VM where you installed the OpenBSD operating system 6.1, which added Hyper-V support, complete the following procedures:

If DHCP is not enabled during installation, enable the service as follows:

By default, the root user is disabled on virtual machines in Azure. Users can run commands with elevated privileges by using the doas command on OpenBSD VM. Doas is enabled by default. For more information, see doas.conf.

Deprovision the system to clean it and make it suitable for reprovisioning. The following command also deletes the last provisioned user account and the associated data:

waagent -deprovision+user -force

Now you can shut down your VM.

Prepare the VHD

The VHDX format is not supported in Azure, only fixed VHD. You can convert the disk to fixed VHD format using Hyper-V Manager or the Powershell convert-vhd cmdlet. An example is as following.

Convert-VHD OpenBSD61.vhdx OpenBSD61.vhd -VHDType Fixed

Create storage resources and upload

First, create a resource group with az group create. The following example creates a resource group named myResourceGroup in the eastus location:

az group create --name myResourceGroup --location eastus

To upload your VHD, create a storage account with az storage account create. Storage account names must be unique, so provide your own name. The following example creates a storage account named mystorageaccount: