Upgrading the Azure IIoT Stack
Microsoft Azure IIoT changes frequently. With v.4.2.0, the ThingWorx Azure IIoT OPC UA integration implements a newer release of the Azure IIoT stack, This topic explains how to upgrade the Azure IIoT Stack in your deployment.
It is recommended that you upgrade the Microsoft Azure IIoT Stack first and then the ThingWorx Azure IoT Hub Connector. .
If you are a customer of PTC Cloud Services, the upgrade is done for you. If you manually installed the integration, this topic will guide you through the upgrade of the Azure IIoT stack.
The following sections take you through the upgrade process, from prerequisites to troubleshooting. Click the title of a section to display its content. To hide the content, click the title again.
To ensure a smooth upgrade, stop any and all VMs that are running microservices and shut down your ThingWorx Platform. To avoid any issues with publishing intervals, delete these microservices as well.
For the upgrade process, you need to know the name that was provided for the namespace when the Azure Industrial IoT (IIoT) Microservices were deployed (). For example, the instructions in Deploying the Azure Industrial IoT (IIoT) Microservices, call the namespace, aiiot.
How to Upgrade
Follow these steps to upgrade the Azure IIoT stack:
1. If you do not have a values.yaml file present in your repository, download one, using the following command and replacing <NAMESPACE_NAME> with the name of your namespace:

helm get values <RELEASE_NAME> --namespace <NAMESPACE_NAME> > values.yaml
If you do not know your <RELEASE_NAME> you can find it by running the following command:

helm ls --namespace <NAME_SPACE_NAME>
The name of your release is what is displayed under "NAME".
2. Add the following to the end of your new values.yaml file. Replace the placeholder value of tag, DESIRED_VERSION_NUMBER, with the version to which you want to upgrade:

3. To upgrade your Kubernetes deployment, run the following command:

helm upgrade --install <RELEASE_NAME> azure-iiot/azure-industrial-iot --namespace <NAMESPACE_NAME> -f values.yaml
If an error is returned, follow these steps:
a. Run the command, helm repo update.
b. If the repo is not found when you run this command, run the following command to add the helm repo:

helm repo add azure-iiot https://azureiiot.blob.core.windows.net/helm
c. Run helm repo update again.
d. Run the upgrade command again:

helm upgrade --install <RELEASE_NAME> azure-iiot/azure-industrial-iot --namespace <NAMESPACE_NAME> -f values.yaml
If no error is returned, go to Step 6. If the error persists, continue with Steps 4 and 5.
4. If the error persists while upgrading the deployment, then run the following command to delete the old deployment and continue to step 5:

5. Run the following command to start the new deployment:

helm install <RELEASE_NAME> azure-iiot/azure-industrial-iot --namespace <NAMESPACE_NAME> -f values.yaml
If this command does not work, try running the following command and then rerunning the helm install command above:

helm repo update
6. The modules should begin deploying. When the deployment is complete, check the Azure Portal to ensure that the Discovery, Twin, and Publisher modules all have the new version listed.
7. Check your modules on Kubernetes to ensure the correct version is listed:
a. Run the following command to retrieve a list of your pods:

kubectl get pods -n <NAMESPACE_NAME>
b. If you not already set your namespace, do so now. Otherwise, the pod may not be found in the next step:

kubectl config set-context --current --namespace=<NAMESPACE_NAME>
c. Select the name of one of the pods and run the following command, replacing <POD_NAME> with the name of one of your pods:

kubectl describe pod <POD_NAME>
d. You will see a lot of information returned. Navigate to the "Containers" part of this information, then to "Image", and make sure that the correct version is listed at the end. For example:

Once the upgrade is complete, verify that the pods are publishing and that you are receiving telemetry on ThingWorx. If there are any issues, refer to the Troubleshooting section below. If you are not receiving telemetry via ThingWorx, use an application such as Microsoft VisualStudio Code to verify telemetry is being sent and troubleshoot from there.
Does an upgrade to the Azure IIoT stack also mean an upgrade to the ThingWorx Azure IoT Hub Connector, or can the Azure IIoT stack be upgraded in isolation?
The Azure IIoT stack can be upgraded in isolation. This was confirmed when manually upgrading from 2.7.199 to the latest approved version. For current version compatibility information, see the Release Advisor. The components that were modified during the sample upgrade performed included the Publisher, Discovery, and Twin modules.
Is there any downtime expected?
Any downtime during a normal upgrade process of the IIoT stack should be largely trivial. It is good practice to either make sure any VMs are turned off while redeploying the modules, or to at least restart the VMs once the new deployment is complete. Otherwise, the upgrade may not work as intended.
Industrial Gateway Thing is not connected
It is likely that a new certificate needs to be trusted in ThingWorx Kepware Server. Please make sure that any new certificates generated are trusted. You may need to restart your ThingWorx Platform after this as well.
Telemetry is not flowing
You may need to restart your VMs and/or IoT Edge runtime for the changes in the upgrade to take effect and allow telemetry to begin flowing again.
When I change one property's publishing rate, the interval for all properties changes to that rate.
To run multiple nodes with different publishing intervals, you must upgrade to v.the latest approved version. of the Microsoft Azure Industrial IoT (IIoT) stack. Earlier versions do not provide this capability. If, after upgrading, you notice that publishing intervals are being reset for all properties bound to different tags, rather than just the one property you changed in ThingWorx Composer, make sure that your namespace is running the latest approved version. and that your edge modules are no longer communicating with microservices on an older namespace. The publishing intervals for properties all being changed when you change it for one is a good indicator that there is a mismatch of microservices versions.
It is not possible to have two properties bound to the same tag publish at different rates. If you have prop1 and prop2 with both bound to the RampDouble tag, they both publish at the same rate. If the publishing interval for prop1 is four seconds and for prop2 is two seconds, both properties publish at the shorter rate between the two properties, which in this example is two seconds.
Microsoft does not support two namespaces sharing the same unique set of underlying Azure resources. In addition, Microsoft does not support the simultaneous operation of old and new deployments using the same Azure Resources. Check whether two namespaces are sharing the same Azure Resources. This might occur after an upgrade.
If you are a system administrator with access to the Azure Portal and your IoT Edge devices, you can go to IoT Edge and click IoT Edge Deployments to see how your Kubernetes pods are working and also whether layered deployment is successful.