Step 4. Deploying Your OPC UA Server and Setting Up the IoT Edge Runtime Device
Now that you have deployed the Azure Industrial IoT (IIoT) Microservices, set up your OPC UA server on a compatible device, if you have not already done so. You then need to stand up an IoT Edge device and the IoT Edge runtime.
Set Up Your OPC UA Server
|
After setting up your OPC UA Server, your next step is to install the IoT Edge runtime on a separate virtual machine or computer, and deploy all the necessary modules. Microsoft recommends that the Azure IoT Edge runtime be used on Linux.
|
Stand Up the IoT Edge Runtime
|
A layered deployment is an automatic deployment that ensures that the versions of the Azure IoT Edge runtime modules match the versions of the Azure IIoT Microservices.
|
In this procedure you are going to create the IoT Edge device for the IoT Edge runtime modules and create a layered deployment.
To stand up an IoT Edge Device and the IoT Edge runtime device from Windows PowerShell, follow these steps:
1. Sign in to your Azure account so that you can access the Azure Portal.
4. Once you have verified a successful setup of the Azure IoT Edge device and Azure IoT Edge runtime you need to
Install the Industrial Modules by setting up a layered deployment for the device via the Azure portal. To start, open the device on your IoT Hub in the Azure portal. The following figure shows a list of devices for an IoT Hub in the Azure portal:
After opening a device, select Device twin from the menu. The Device twin page allows you to edit the device twin and add the following tags:
"tags": {
"__type__": "iiotedge",
"os": "Linux"
},
as shown in the figure below:
wn in the figure below:
Once you have added the tags, click Save.
5. It may take 10-15 minutes for the modules to deploy. The following command can be run on the Azure IoT Edge runtime VM to display the modules and their versions:
sudo iotedge list
You should see references to the following modules in addition to the azureiotedge-agent and azureiotedge-hub in the output.
◦ mcr.microsoft.com/iotedge/opc-publisher:2.8
◦ mcr.microsoft.com/iotedge/opc-twin:2.8
◦ mcr.microsoft.com/iotedge/discovery:2.8
After the IoT Edge runtime connection is established, the layered deployment should take care of provisioning the edge with the required edge modules.
Configuring the Protocol
Every Azure IoT Edge runtime has two modules, the IoT Edge hub and the IoT Edge agent. You can set the upstream protocol for these modules. They support AMQP (default) and MQTT only. For details about the IoT Edge hub module of the Azure IoT Edge runtime, refer to
IoT Edge hub in the Microsoft Azure IoT Edge documentation. Similarly, for details about the IoT Edge agent module, refer to
IoT Edge agent in the Microsoft Azure IoT Edge documentation.
The protocol used by your OPC UA Server is configured when the IoT Edge runtime module is deployed. Here is a link to Microsoft documentation that describes deployment of Azure IoT Edge runtime modules in a production environment:
Prepare to deploy your IoT Edge solution in production . The section, "Choose upstream protocol", explains the possible configuration values for the two IoT Edge runtime modules, IoT Edge hub and the IoT Edge agent. These modules support clients that connect using not only MQTT or AMQP but also AMQP and MQTT over WebSockets, respectively called AMQPWS and MQTTWS. It does not support clients that use HTTP.
The upstream protocol for the IoT Edge agent is set in the config.yaml file on the device itself. Once your IoT Edge device connects, be sure to continue configuring the UpstreamProtocol variable for both runtime modules in future deployments. Alternatively, if you need to change the protocol, be sure you set the variable for the IoT Edge agent where necessary in your deployments.
Checkpoint: Configure the OPC PLC Demo (optional)
As a mid-way check of your Azure deployments, you can install and run the OPC PLC demo simulator. This step is optional. To deploy an OPC PLC simulator follow the steps provided in the
start the demo OPC UA server section of the Microsoft Azure Industrial IoT documentation.
Register and Activate Your OPC UA Server
What's Next?