Skip to content

Commit 70ef712

Browse files
authored
Merge pull request #209650 from mumian/0829-iot-edge
[IoT Edge] - new Bicep quickstart
2 parents 58f7c69 + 8e92409 commit 70ef712

File tree

3 files changed

+176
-10
lines changed

3 files changed

+176
-10
lines changed

articles/iot-edge/TOC.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
- name: Multiple NICs
4747
href: how-to-configure-multiple-nics.md
4848
- name: VM on a DMZ
49-
href: how-to-configure-iot-edge-for-linux-on-windows-iiot-dmz.md
49+
href: how-to-configure-iot-edge-for-linux-on-windows-iiot-dmz.md
5050
- name: Configure nested virtualization for Windows VMs
5151
href: nested-virtualization.md
5252
- name: Access TPM secrets
@@ -105,7 +105,7 @@
105105
- name: C#
106106
href: tutorial-csharp-module-windows.md
107107
- name: Deploy Azure services as modules
108-
items:
108+
items:
109109
- name: Filter data with Azure Functions
110110
href: tutorial-deploy-function.md
111111
- name: Find averages with Azure Stream Analytics
@@ -201,7 +201,7 @@
201201
- name: X.509 certificate attestation
202202
href: how-to-provision-devices-at-scale-linux-x509.md
203203
- name: TPM attestation
204-
href: how-to-provision-devices-at-scale-linux-tpm.md
204+
href: how-to-provision-devices-at-scale-linux-tpm.md
205205
- name: Symmetric key attestation
206206
href: how-to-provision-devices-at-scale-linux-symmetric.md
207207
- name: Windows containers on Windows hosts
@@ -226,6 +226,9 @@
226226
href: how-to-manage-device-certificates.md
227227
- name: Run IoT Edge on Kubernetes
228228
href: how-to-install-iot-edge-kubernetes.md
229+
- name: Deploy IoT Edge VM using a Bicep file
230+
displayname: ARM,template,resource manager
231+
href: how-to-install-iot-edge-ubuntuvm-bicep.md
229232
- name: Deploy IoT Edge VM using an ARM template
230233
href: how-to-install-iot-edge-ubuntuvm.md
231234
- name: Develop custom modules
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
---
2+
title: Run Azure IoT Edge on Ubuntu Virtual Machines by using Bicep | Microsoft Docs
3+
description: Azure IoT Edge setup instructions for Ubuntu LTS Virtual Machines by using Bicep
4+
author: toolboc
5+
ms.service: iot-edge
6+
services: iot-edge
7+
ms.topic: conceptual
8+
ms.date: 08/29/2022
9+
ms.author: pdecarlo
10+
11+
---
12+
# Run Azure IoT Edge on Ubuntu Virtual Machines by using Bicep
13+
14+
[!INCLUDE [iot-edge-version-201806-or-202011](../../includes/iot-edge-version-201806-or-202011.md)]
15+
16+
The Azure IoT Edge runtime is what turns a device into an IoT Edge device. The runtime can be deployed on devices as small as a Raspberry Pi or as large as an industrial server. Once a device is configured with the IoT Edge runtime, you can start deploying business logic to it from the cloud.
17+
18+
To learn more about how the IoT Edge runtime works and what components are included, see [Understand the Azure IoT Edge runtime and its architecture](iot-edge-runtime.md).
19+
20+
:::moniker range="iotedge-2018-06"
21+
This article lists the steps to deploy an Ubuntu 18.04 LTS virtual machine with the Azure IoT Edge runtime installed and configured using a pre-supplied device connection string. The deployment is accomplished using a [cloud-init](../virtual-machines/linux/using-cloud-init.md) based [Bicep file](../azure-resource-manager/bicep/overview.md) maintained in the [iotedge-vm-deploy](https://github.com/Azure/iotedge-vm-deploy/tree/1.1) project repository.
22+
23+
On first boot, the virtual machine [installs the latest version of the Azure IoT Edge runtime via cloud-init](https://github.com/Azure/iotedge-vm-deploy/blob/1.1/cloud-init.txt). It also sets a supplied connection string before the runtime starts, allowing you to easily configure and connect the IoT Edge device without the need to start an SSH or remote desktop session.
24+
:::moniker-end
25+
:::moniker range=">=iotedge-2020-11"
26+
This article lists the steps to deploy an Ubuntu 20.04 LTS virtual machine with the Azure IoT Edge runtime installed and configured using a pre-supplied device connection string. The deployment is accomplished using a [cloud-init](../virtual-machines/linux/using-cloud-init.md) based [Bicep file](../azure-resource-manager/bicep/overview.md) maintained in the [iotedge-vm-deploy](https://github.com/Azure/iotedge-vm-deploy/tree/1.3) project repository.
27+
28+
On first boot, the virtual machine [installs the latest version of the Azure IoT Edge runtime via cloud-init](https://github.com/Azure/iotedge-vm-deploy/blob/1.3/cloud-init.txt). It also sets a supplied connection string before the runtime starts, allowing you to easily configure and connect the IoT Edge device without the need to start an SSH or remote desktop session.
29+
:::moniker-end
30+
31+
## Deploy from Azure CLI
32+
33+
You can't deploy a remote Bicep file. Save a copy of the [Bicep file](https://raw.githubusercontent.com/Azure/iotedge-vm-deploy/master/edgeDeploy.bicep) locally as **main.bicep**.
34+
35+
1. Ensure that you have installed the Azure CLI iot extension with:
36+
37+
```azurecli
38+
az extension add --name azure-iot
39+
```
40+
41+
1. Next, if you're using Azure CLI on your desktop, start by logging in:
42+
43+
```azurecli
44+
az login
45+
```
46+
47+
1. If you have multiple subscriptions, select the subscription you'd like to use:
48+
1. List your subscriptions:
49+
50+
```azurecli
51+
az account list --output table
52+
```
53+
54+
1. Copy the SubscriptionID field for the subscription you'd like to use.
55+
56+
1. Set your working subscription with the ID that you copied:
57+
58+
```azurecli
59+
az account set -s <SubscriptionId>
60+
```
61+
62+
1. Create a new resource group (or specify an existing one in the next steps):
63+
64+
```azurecli
65+
az group create --name IoTEdgeResources --location westus2
66+
```
67+
68+
1. Create a new virtual machine:
69+
:::moniker range="iotedge-2018-06"
70+
To use an **authenticationType** of `password`, see the example below:
71+
72+
```azurecli
73+
az deployment group create \
74+
--resource-group IoTEdgeResources \
75+
--template-file "main.bicep" \
76+
--parameters dnsLabelPrefix='my-edge-vm1' \
77+
--parameters deviceConnectionString=$(az iot hub device-identity connection-string show --device-id <REPLACE_WITH_DEVICE-NAME> --hub-name <REPLACE-WITH-HUB-NAME> -o tsv) \
78+
--parameters authenticationType='password' \
79+
--parameters adminUsername='<REPLACE_WITH_USERNAME>' \
80+
--parameters adminPasswordOrKey="<REPLACE_WITH_SECRET_PASSWORD>"
81+
```
82+
83+
To authenticate with an SSH key, you may do so by specifying an **authenticationType** of `sshPublicKey`, then provide the value of the SSH key in the **adminPasswordOrKey** parameter. An example is shown below.
84+
85+
```azurecli
86+
#Generate the SSH Key
87+
ssh-keygen -m PEM -t rsa -b 4096 -q -f ~/.ssh/iotedge-vm-key -N ""
88+
89+
#Create a VM using the iotedge-vm-deploy script
90+
az deployment group create \
91+
--resource-group IoTEdgeResources \
92+
--template-file "main.bicep" \
93+
--parameters dnsLabelPrefix='my-edge-vm1' \
94+
--parameters deviceConnectionString=$(az iot hub device-identity connection-string show --device-id <REPLACE_WITH_DEVICE-NAME> --hub-name <REPLACE-WITH-HUB-NAME> -o tsv) \
95+
--parameters authenticationType='sshPublicKey' \
96+
--parameters adminUsername='<REPLACE_WITH_USERNAME>' \
97+
--parameters adminPasswordOrKey="$(< ~/.ssh/iotedge-vm-key.pub)"
98+
```
99+
100+
:::moniker-end
101+
:::moniker range=">=iotedge-2020-11"
102+
To use an **authenticationType** of `password`, see the example below:
103+
104+
```azurecli
105+
az deployment group create \
106+
--resource-group IoTEdgeResources \
107+
--template-file "main.bicep" \
108+
--parameters dnsLabelPrefix='my-edge-vm1' \
109+
--parameters deviceConnectionString=$(az iot hub device-identity connection-string show --device-id <REPLACE_WITH_DEVICE-NAME> --hub-name <REPLACE-WITH-HUB-NAME> -o tsv) \
110+
--parameters authenticationType='password' \
111+
--parameters adminUsername='<REPLACE_WITH_USERNAME>' \
112+
--parameters adminPasswordOrKey="<REPLACE_WITH_SECRET_PASSWORD>"
113+
```
114+
115+
To authenticate with an SSH key, you may do so by specifying an **authenticationType** of `sshPublicKey`, then provide the value of the SSH key in the **adminPasswordOrKey** parameter. An example is shown below.
116+
117+
```azurecli
118+
#Generate the SSH Key
119+
ssh-keygen -m PEM -t rsa -b 4096 -q -f ~/.ssh/iotedge-vm-key -N ""
120+
121+
#Create a VM using the iotedge-vm-deploy script
122+
az deployment group create \
123+
--resource-group IoTEdgeResources \
124+
--template-file "main.bicep" \
125+
--parameters dnsLabelPrefix='my-edge-vm1' \
126+
--parameters deviceConnectionString=$(az iot hub device-identity connection-string show --device-id <REPLACE_WITH_DEVICE-NAME> --hub-name <REPLACE-WITH-HUB-NAME> -o tsv) \
127+
--parameters authenticationType='sshPublicKey' \
128+
--parameters adminUsername='<REPLACE_WITH_USERNAME>' \
129+
--parameters adminPasswordOrKey="$(< ~/.ssh/iotedge-vm-key.pub)"
130+
```
131+
132+
:::moniker-end
133+
134+
1. Verify that the deployment has completed successfully. A virtual machine resource should have been deployed into the selected resource group. Take note of the machine name, this should be in the format `vm-0000000000000`. Also, take note of the associated **DNS Name**, which should be in the format `<dnsLabelPrefix>`.`<location>`.cloudapp.azure.com.
135+
136+
The **DNS Name** can be obtained from the JSON-formatted output of the previous step, within the **outputs** section as part of the **public SSH** entry. The value of this entry can be used to SSH into to the newly deployed machine.
137+
138+
```bash
139+
"outputs": {
140+
"public SSH": {
141+
"type": "String",
142+
"value": "ssh <adminUsername>@<DNS_Name>"
143+
}
144+
}
145+
```
146+
147+
The **DNS Name** can also be obtained from the **Overview** section of the newly deployed virtual machine within the Azure portal.
148+
149+
> [!div class="mx-imgBorder"]
150+
> [![Screenshot showing the DNS name of the IoT Edge Virtual Machine.](./media/how-to-install-iot-edge-ubuntuvm/iotedge-vm-dns-name.png)](./media/how-to-install-iot-edge-ubuntuvm/iotedge-vm-dns-name.png)
151+
152+
1. If you want to SSH into this VM after setup, use the associated **DNS Name** with the command:
153+
`ssh <adminUsername>@<DNS_Name>`
154+
155+
## Next steps
156+
157+
Now that you have an IoT Edge device provisioned with the runtime installed, you can [deploy IoT Edge modules](how-to-deploy-modules-portal.md).
158+
159+
If you are having problems with the IoT Edge runtime installing properly, check out the [troubleshooting](troubleshoot.md) page.
160+
161+
To update an existing installation to the newest version of IoT Edge, see [Update the IoT Edge security daemon and runtime](how-to-update-iot-edge.md).
162+
163+
If you'd like to open up ports to access the VM through SSH or other inbound connections, refer to the Azure Virtual Machines documentation on [opening up ports and endpoints to a Linux VM](../virtual-machines/linux/nsg-quickstart.md)

articles/iot-edge/how-to-install-iot-edge-ubuntuvm.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.service: iot-edge
99
services: iot-edge
1010
ms.topic: conceptual
1111
ms.date: 01/20/2022
12-
ms.author: pdecarlo
12+
ms.author: pdecarlo
1313

1414
---
1515
# Run Azure IoT Edge on Ubuntu Virtual Machines
@@ -33,7 +33,7 @@ On first boot, the virtual machine [installs the latest version of the Azure IoT
3333

3434
## Deploy using Deploy to Azure Button
3535

36-
The [Deploy to Azure Button](../azure-resource-manager/templates/deploy-to-azure-button.md) allows for streamlined deployment of [Azure Resource Manager templates](../azure-resource-manager/templates/overview.md) maintained on GitHub. This section will demonstrate usage of the Deploy to Azure Button contained in the [iotedge-vm-deploy](https://github.com/Azure/iotedge-vm-deploy) project repository.
36+
The [Deploy to Azure Button](../azure-resource-manager/templates/deploy-to-azure-button.md) allows for streamlined deployment of [Azure Resource Manager templates](../azure-resource-manager/templates/overview.md) maintained on GitHub. This section will demonstrate usage of the Deploy to Azure Button contained in the [iotedge-vm-deploy](https://github.com/Azure/iotedge-vm-deploy) project repository.
3737

3838
1. We will deploy an Azure IoT Edge enabled Linux VM using the iotedge-vm-deploy Azure Resource Manager template. To begin, click the button below:
3939
:::moniker range="iotedge-2018-06"
@@ -123,18 +123,18 @@ The [Deploy to Azure Button](../azure-resource-manager/templates/deploy-to-azure
123123
--resource-group IoTEdgeResources \
124124
--template-uri "https://raw.githubusercontent.com/Azure/iotedge-vm-deploy/1.1/edgeDeploy.json" \
125125
--parameters dnsLabelPrefix='my-edge-vm1' \
126-
--parameters adminUsername='<REPLACE_WITH_USERNAME>' \
127126
--parameters deviceConnectionString=$(az iot hub device-identity connection-string show --device-id <REPLACE_WITH_DEVICE-NAME> --hub-name <REPLACE-WITH-HUB-NAME> -o tsv) \
128127
--parameters authenticationType='password' \
128+
--parameters adminUsername='<REPLACE_WITH_USERNAME>' \
129129
--parameters adminPasswordOrKey="<REPLACE_WITH_SECRET_PASSWORD>"
130130
```
131131

132132
To authenticate with an SSH key, you may do so by specifying an **authenticationType** of `sshPublicKey`, then provide the value of the SSH key in the **adminPasswordOrKey** parameter. An example is shown below.
133133

134134
```azurecli-interactive
135135
#Generate the SSH Key
136-
ssh-keygen -m PEM -t rsa -b 4096 -q -f ~/.ssh/iotedge-vm-key -N ""
137-
136+
ssh-keygen -m PEM -t rsa -b 4096 -q -f ~/.ssh/iotedge-vm-key -N ""
137+
138138
#Create a VM using the iotedge-vm-deploy script
139139
az deployment group create \
140140
--resource-group IoTEdgeResources \
@@ -164,8 +164,8 @@ The [Deploy to Azure Button](../azure-resource-manager/templates/deploy-to-azure
164164

165165
```azurecli-interactive
166166
#Generate the SSH Key
167-
ssh-keygen -m PEM -t rsa -b 4096 -q -f ~/.ssh/iotedge-vm-key -N ""
168-
167+
ssh-keygen -m PEM -t rsa -b 4096 -q -f ~/.ssh/iotedge-vm-key -N ""
168+
169169
#Create a VM using the iotedge-vm-deploy script
170170
az deployment group create \
171171
--resource-group IoTEdgeResources \

0 commit comments

Comments
 (0)