You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Learn how to create and upload a virtual hard disk (VHD) that contains the OpenBSD operating system to create an Azure virtual machine through Azure CLI
3
+
description: Learn how to create and upload a virtual hard disk (VHD) that contains the OpenBSD operating system to create an Azure virtual machine through the Azure CLI.
# Create and Upload an OpenBSD disk image to Azure
14
13
15
-
**Applies to:**:heavy_check_mark: Linux VMs :heavy_check_mark: Flexible scale sets
14
+
# Create and upload an OpenBSD disk image to Azure
16
15
17
-
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.
16
+
**Applies to:**:heavy_check_mark: Linux VMs :heavy_check_mark: Flexible scale sets
18
17
18
+
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 the Azure CLI.
19
19
20
20
## Prerequisites
21
+
21
22
This article assumes that you have the following items:
22
23
23
-
***An Azure subscription** - If you don't have an account, you can create one in just a couple of minutes. If you have an MSDN subscription, see [Monthly Azure credit for Visual Studio subscribers](https://azure.microsoft.com/pricing/member-offers/msdn-benefits-details/). Otherwise, learn how to [create a free trial account](https://azure.microsoft.com/pricing/free-trial/).
24
-
***Azure CLI** - Make sure you have the latest [Azure CLI](/cli/azure/install-azure-cli) installed and logged in to your Azure account with [az login](/cli/azure/reference-index).
25
-
***OpenBSD operating system installed in a .vhd file** - A supported OpenBSD operating system ([6.6 version AMD64](https://ftp.openbsd.org/pub/OpenBSD/7.2/amd64/)) 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](/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh846766(v=ws.11)).
24
+
***An Azure subscription**: If you don't have an account, you can create one in a couple of minutes. If you have an MSDN subscription, see [Monthly Azure credit for Visual Studio subscribers](https://azure.microsoft.com/pricing/member-offers/msdn-benefits-details/). Otherwise, learn how to [create a free trial account](https://azure.microsoft.com/pricing/free-trial/).
25
+
***Azure CLI**: Make sure you have the latest [Azure CLI](/cli/azure/install-azure-cli) installed and logged in to your Azure account with [az login](/cli/azure/reference-index).
26
+
***OpenBSD operating system installed in a .vhd file**: A supported OpenBSD operating system ([6.6 version AMD64](https://ftp.openbsd.org/pub/OpenBSD/7.2/amd64/)) must be installed to a VHD. 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 VM](/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh846766(v=ws.11)).
26
27
28
+
## Prepare an OpenBSD image for Azure
27
29
28
-
## Prepare OpenBSD image for Azure
29
30
On the VM where you installed the OpenBSD operating system 6.1, which added Hyper-V support, complete the following procedures:
30
31
31
-
1. If DHCP is not enabled during installation, enable the service as follows:
32
+
1. If DHCP isn't enabled during installation, enable the service:
32
33
33
34
```sh
34
35
doas echo dhcp > /etc/hostname.hvn0
35
36
```
36
37
37
-
2. Set up a serial console as follows:
38
+
1. Set up a serial console:
38
39
39
40
```sh
40
41
doas echo"stty com0 115200">> /etc/boot.conf
41
42
doas echo"set tty com0">> /etc/boot.conf
42
43
```
43
44
44
-
3. Configure Package installation as follows:
45
+
1. Configure package installation:
45
46
46
47
```sh
47
48
doas echo"https://ftp.openbsd.org/pub/OpenBSD"> /etc/installurl
48
49
```
49
50
50
-
4. By default, the `root` user is disabled on virtual machinesin Azure. Users can run commands with elevated privileges by using the `doas`command on OpenBSD VM. Doas is enabled by default.
51
+
1. By default, the `root` user is disabled on VMsin Azure. Users can run commands with elevated privileges by using the `doas`command on OpenBSD VM. Doas is enabled by default.
51
52
52
-
5. Install and configure prerequisites for the Azure Agent as follows:
53
+
1. Install and configure prerequisites for the Azure agent:
53
54
54
55
```sh
55
56
doas pkg_add py-setuptools openssl git
@@ -59,7 +60,7 @@ On the VM where you installed the OpenBSD operating system 6.1, which added Hype
59
60
doas ln -sf /usr/local/bin/pydoc2.7 /usr/local/bin/pydoc
60
61
```
61
62
62
-
6. The latest release of the Azure agent can always be found on [GitHub](https://github.com/Azure/WALinuxAgent/releases). Install the agent as follows:
63
+
1. You can find the latest release of the Azure agent on [GitHub](https://github.com/Azure/WALinuxAgent/releases). Install the agent:
63
64
64
65
```sh
65
66
doas git clone https://github.com/Azure/WALinuxAgent
@@ -69,40 +70,42 @@ On the VM where you installed the OpenBSD operating system 6.1, which added Hype
69
70
```
70
71
71
72
> [!IMPORTANT]
72
-
> After you install Azure Agent, it's a good idea to verify that it's running as follows:
73
+
> After you install the Azure agent, it's a good idea to verify that it's running:
7. Deprovision the system to clean it and make it suitable for deprovisioning. The following command also deletes the last provisioned user account and the associated data:
81
+
1. Deprovision the system to clean it and make it suitable for deprovisioning. The following command also deletes the last provisioned user account and the associated data:
81
82
82
83
```sh
83
84
doas waagent -deprovision+user -force
84
85
```
86
+
85
87
> [!NOTE]
86
-
> If you are migrating a specific virtual machine and do not wish to create a generalized image, skip the deprovision step.
88
+
> If you're migrating a specific VM and don't want to create a generalized image, skip the deprovision step.
87
89
88
90
Now you can shut down your VM.
89
91
90
-
91
92
## Prepare the VHD
92
-
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](/powershell/module/hyper-v/convert-vhd) cmdlet. An example is as following.
93
+
94
+
The VHDX format isn't supported in Azure, only *fixed VHD*. You can convert the disk to fixed VHD format by using Hyper-V Manager or the PowerShell [convert-vhd](/powershell/module/hyper-v/convert-vhd) cmdlet. Here's an example:
First, create a resource group with [az group create](/cli/azure/group). The following example creates a resource group named *myResourceGroup*in the *eastus* location:
101
+
102
+
First, create a resource group with [az group create](/cli/azure/group). The following example creates a resource group named `myResourceGroup`in the `eastus` location:
100
103
101
104
```azurecli
102
105
az group create --name myResourceGroup --location eastus
103
106
```
104
107
105
-
To upload your VHD, create a storage account with [az storage account create](/cli/azure/storage/account). Storage account names must be unique, so provide your own name. The following example creates a storage account named *mystorageaccount*:
108
+
To upload your VHD, create a storage account with [az storage account create](/cli/azure/storage/account). Storage account names must be unique, so provide your own name. The following example creates a storage account named `mystorageaccount`:
106
109
107
110
```azurecli
108
111
az storage account create --resource-group myResourceGroup \
To control access to the storage account, obtain the storage key with [az storage account keys list](/cli/azure/storage/account/keys) as follows:
117
+
To control access to the storage account, obtain the storage key with the [az storage account keys list](/cli/azure/storage/account/keys):
115
118
116
119
```azurecli
117
120
STORAGE_KEY=$(az storage account keys list \
@@ -129,7 +132,7 @@ az storage container create \
129
132
--account-key ${STORAGE_KEY}
130
133
```
131
134
132
-
Finally, upload your VHD with [az storage blob upload](/cli/azure/storage/blob) as follows:
135
+
Finally, upload your VHD with [az storage blob upload](/cli/azure/storage/blob):
133
136
134
137
```azurecli
135
138
az storage blob upload \
@@ -140,9 +143,9 @@ az storage blob upload \
140
143
--account-key ${STORAGE_KEY}
141
144
```
142
145
146
+
## Create a VM from your VHD
143
147
144
-
## Create VM from your VHD
145
-
You can create a VM with a [sample script](/previous-versions/azure/virtual-machines/scripts/virtual-machines-linux-cli-sample-create-vm-vhd) or directly with [az vm create](/cli/azure/vm). To specify the OpenBSD VHD you uploaded, use the `--image` parameter as follows:
148
+
You can create a VM with a [sample script](/previous-versions/azure/virtual-machines/scripts/virtual-machines-linux-cli-sample-create-vm-vhd) or directly with [az vm create](/cli/azure/vm). To specify the OpenBSD VHD you uploaded, use the `--image` parameter:
146
149
147
150
```azurecli
148
151
az vm create \
@@ -154,7 +157,7 @@ az vm create \
154
157
--ssh-key-value ~/.ssh/id_rsa.pub
155
158
```
156
159
157
-
Obtain the IP address for your OpenBSD VM with [az vm list-ip-addresses](/cli/azure/vm) as follows:
160
+
Obtain the IP address for your OpenBSD VM with [az vm list-ip-addresses](/cli/azure/vm):
158
161
159
162
```azurecli
160
163
az vm list-ip-addresses --resource-group myResourceGroup --name myOpenBSD61
@@ -166,8 +169,7 @@ Now you can SSH to your OpenBSD VM as normal:
166
169
ssh azureuser@<ip address>
167
170
```
168
171
172
+
## Related content
169
173
170
-
## Next steps
171
-
If you want to know more about Hyper-V support on OpenBSD6.1, read [OpenBSD 6.1](https://www.openbsd.org/61.html).
172
-
173
-
If you want to create a VM from managed disk, read [az disk](/cli/azure/disk).
174
+
- To learn more about Hyper-V support on OpenBSD 6.1, read [OpenBSD 6.1](https://www.openbsd.org/61.html).
175
+
- To create a VM from a managed disk, read [az disk](/cli/azure/disk).
0 commit comments