ThingWorx Azure IoT Hub Connector for Microsoft Azure Industrial IoT (IIoT) for OPC UA > Step 4. Deploying Your OPC UA Server and Setting Up the IoT Edge Runtime Device
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
* 
If desired, you can use the ThingWorx Kepware Server (TKS) as a test for your Azure setup, you can download and install ThingWorx Kepware Server on a trial basis (2 hours' runtime). For instructions on installing TKS, refer to Industrial Connections Example in the ThingWorx Platform 9 Help Center.
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
For background information on Azure IoT Edge runtime, see the Microsoft Azure article, Understand the Azure IoT Edge runtime and its architecture.
* 
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.
2. Start by performing the steps in the Microsoft document to create and register an IoT Edge Device in the IoT Hub, Register an IoT Edge device in IoT Hub.
3. Once you have created your IoT Edge device in the IoT Hub, refer to Install Azure IoT Edge for Linux to install the Azure IoT Edge runtime. Refer to the section, Verify successful installation, to ensure that you have successfully installed the IoT Edge runtime and that it is connected to the IoT Edge Device created in the previous step.
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
Now that you have your IoT Edge device set up, you can interact with it using the instructions in the Git Hub article, Discover and register servers and browse their address space, read and publish nodes via REST API in Postman.
What's Next?
1. If you have not already done so, continue to Step 5. Setting Up the ThingWorx Azure IoT Hub Connector to set up the ThingWorx Azure IoT Hub Connector for this Azure Industrial IoT OPC UA integration.
2. Using ThingWorx Composer, add non-administrative users and assign permissions to them, as explained in Step 6. Setting Permissions for Non-Administrative Users.
3. Using ThingWorx Composer, navigate to the OPC UA mashups to configure your OPC UA applications and endpoints, as explained in Step 7. Using ThingWorx OPC UA Mashups to Configure Your OPC UA Applications and Endpoints.
4. Using ThingWorx Composer, create Industrial Gateways and Edge Things, as explained in Step 8. Creating the Industrial Gateway and IoT Edge Things for Telemetry and also, in more detail, in Industrial Connections.