Skip to content

Commit 758b110

Browse files
Merge pull request #203205 from kgremban/jun28-baltimore
IoT Hub tls certificate migration
2 parents fda37f1 + 26197ea commit 758b110

File tree

4 files changed

+194
-0
lines changed

4 files changed

+194
-0
lines changed

articles/iot-hub/TOC.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,9 @@
508508
href: troubleshoot-message-routing.md
509509
- name: Resolve error codes
510510
href: troubleshoot-error-codes.md
511+
- name: Migrate TLS certificate root
512+
href: migrate-tls-certificate.md
513+
511514
- name: Reference
512515
items:
513516
- name: Azure CLI
104 KB
Loading
52.8 KB
Loading
Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
---
2+
title: How to migrate hub root certificate - Azure IoT Hub
3+
description: Migrate all Azure IoT hub instances to use the new DigiCert Global G2 root certificate to maintain device connectivity.
4+
author: kgremban
5+
ms.author: kgremban
6+
manager: lizross
7+
ms.service: iot-hub
8+
services: iot-hub
9+
ms.topic: conceptual
10+
ms.date: 12/09/2022
11+
---
12+
13+
# Migrate IoT Hub resources to a new TLS certificate root
14+
15+
Azure IoT Hub and Device Provisioning Service (DPS) use TLS certificates issued by the Baltimore CyberTrust Root, which expires in 2025. Starting in February 2023, all IoT hubs in the global Azure cloud will migrate to a new TLS certificate issued by the DigiCert Global Root G2.
16+
17+
You should start planning now for the effects of migrating your IoT hubs to the new TLS certificate:
18+
19+
* Any device that doesn't have the DigiCert Global Root G2 in its certificate store won't be able to connect to Azure.
20+
* The IP address of the IoT hub will change.
21+
22+
## Timeline
23+
24+
The IoT Hub team will begin migrating IoT hubs by region on **February 15, 2023**. After all IoT hubs have migrated, then DPS will perform its migration.
25+
26+
### Request an extension
27+
28+
This TLS certificate migration is critical for the security of our customers and Microsoft's infrastructure, and is time-bound by the expiration of the Baltimore CyberTrust Root certificate. Therefore, there's little extra time that we can provide for customers that don't think their devices will be ready by February 15, 2023. If you absolutely can't meet the February 2023 target date, [contact us](mailto:[email protected]?subject=Baltimore%20Migration:%20Request%20for%20whitelisting%20%3ccustomer%20name%3e%20hubs%20) and provide the details of the IoT hub(s) that need more time. We can flag them to be migrated at the end of the rollout window.
29+
30+
## Required steps
31+
32+
To prepare for the migration, take the following steps before February 2023:
33+
34+
1. Keep the Baltimore CyberTrust Root in your devices' trusted root store and add the DigiCert Global Root G2. You can download both certificates from the [DigiCert trusted root authority](https://www.digicert.com/kb/digicert-root-certificates.htm).
35+
36+
It's important to have both certificates on your devices until the IoT Hub and DPS migrations are complete. Keeping the Baltimore CyberTrust Root ensures that your devices will stay connected until the migration, and adding the DigiCert Global Root G2 ensures that your devices will seamlessly switch over and reconnect after the migration.
37+
38+
2. Make sure that you aren't pinning any intermediate or leaf certificates, and are using the public roots to perform TLS server validation.
39+
40+
IoT Hub and DPS occasionally roll over their intermediate certificate authority (CA). In these instances, your devices will lose connectivity if they explicitly look for an intermediate CA or leaf certificate. However, devices that perform validation using the public roots will continue to connect regardless of any changes to the intermediate CA.
41+
42+
For more information about how to test whether your devices are ready for the TLS certificate migration, see the blog post [Azure IoT TLS: Critical changes are almost here](https://techcommunity.microsoft.com/t5/internet-of-things-blog/azure-iot-tls-critical-changes-are-almost-here-and-why-you/ba-p/2393169).
43+
44+
## Optional manual IoT hub migration
45+
46+
If you've prepared your devices and are ready for the TLS certificate migration before February 2023, you can manually migrate your IoT hub root certificates yourself.
47+
48+
After you migrate to the new root certificate, it will take about 45 minutes for all devices to disconnect and reconnect with the new certificate. This timing is because the Azure IoT SDKs are programmed to reverify their connection every 45 minutes. If you've implemented a different pattern in your solution, then your experience may vary.
49+
50+
>[!NOTE]
51+
>There is no manual migration option for Device Provisioning Service instances. That migration will happen automatically once all IoT hub instances have migrated. No additional action is required from you beyond having the new root certificate on your devices.
52+
53+
# [Azure portal](#tab/portal)
54+
55+
1. In the [Azure portal](https://portal.azure.com), navigate to your IoT hub.
56+
57+
1. Select **Certificates** in the **Security settings** section of the navigation menu.
58+
59+
1. Select the **TLS certificate** tab and select **Migrate to DigiCert Global G2**.
60+
61+
:::image type="content" source="./media/migrate-tls-certificate/migrate-to-digicert-global-g2.png" alt-text="Screenshot of the TLS certificate tab, select 'Migrate to DigiCert Global G2.'":::
62+
63+
1. A series of checkboxes asks you to verify that you've prepared your devices for the migration. Check each box, confirming that your IoT solution is ready for the migration. Then, select **Update**.
64+
65+
1. Use the **Connected Devices** metric to verify that your devices are successfully reconnecting with the new certificate.
66+
67+
For more information about monitoring your devices, see [Monitoring IoT Hub](monitor-iot-hub.md).
68+
69+
If you encounter any issues, you can undo the migration and revert to the Baltimore CyberTrust Root certificate.
70+
71+
1. Select **Revert to Baltimore root** to undo the migration.
72+
73+
1. Again, a series of checkboxes asks you to verify that you understand how reverting to the Baltimore CyberTrust Root will affect your devices. Check each box, then select **Update**.
74+
75+
# [Azure CLI](#tab/cli)
76+
77+
Use the [az extension update](/cli/azure/extension#az-extension-update) command to make sure you have the latest version of the `azure-iot` extension.
78+
79+
```azurecli-interactive
80+
az extension update --name azure-iot
81+
```
82+
83+
Use the [az iot hub certificate root-authority show](/cli/azure/iot/hub/certificate/root-authority#az-iot-hub-certificate-root-authority-show) command to view the current certificate root-authority for your IoT hub.
84+
85+
```azurecli-interactive
86+
az iot hub certificate root-authority show --hub-name <iothub_name>
87+
```
88+
89+
>[!TIP]
90+
>In the Azure CLI, the existing Baltimore CyberTrust Root certificate is referred to as `v1`, and the new DigiCert Global Root G2 certificate is referred to as `v2`.
91+
92+
Use the [az iot hub certificate root-authority set](/cli/azure/iot/hub/certificate/root-authority#az-iot-hub-certificate-root-authority-set) command to migrate your IoT hub to the new DigiCert Global Root G2 certificate.
93+
94+
```azurecli-interactive
95+
az iot hub certificate root-authority set --hub-name <iothub_name> --certificate-authority v2
96+
```
97+
98+
Verify that your migration was successful. We recommend using the **connected devices** metric to view devices disconnecting and reconnecting post-migration.
99+
100+
For more information about monitoring your devices, see [Monitoring IoT Hub](monitor-iot-hub.md).
101+
102+
If you encounter any issues, you can undo the migration and revert to the Baltimore CyberTrust Root certificate by running the previous command again with `--certificate authority v1`.
103+
104+
---
105+
106+
## Frequently asked questions
107+
108+
### My devices uses SAS/X.509/TPM authentication. Will this migration affect my devices?
109+
110+
Migrating the TLS certificate doesn't affect how devices are authenticated by IoT Hub. This migration does affect how devices authenticate the IoT Hub and DPS endpoints.
111+
112+
IoT Hub and DPS present their server certificate to devices, and devices authenticate that certificate against the root in order to trust their connection to the endpoints. Devices will need to have the new DigiCert Global Root G2 in their trusted certificate stores to be able to verify and connect to Azure after this migration.
113+
114+
### My devices use the Azure IoT SDKs to connect. Do I have to do anything to keep the SDKs working with the new certificate?
115+
116+
It depends.
117+
118+
* **Yes**, if you use the Java V1 device client. This client packages the Baltimore Cybertrust Root certificate along with the SDK. You can either update to Java V2 or manually add the DigiCert Global Root G2 certificate to your source code.
119+
* **No**, if you use the other Azure IoT SDKs. Most Azure IoT SDKs rely on the underlying operating system’s certificate store to retrieve trusted roots for server authentication during the TLS handshake.
120+
121+
Regardless of the SDK used, we highly recommended that all customers validate their devices before migration, as described in the validation section of the blog post [Azure IoT TLS: Critical changes are almost here](https://techcommunity.microsoft.com/t5/internet-of-things-blog/azure-iot-tls-critical-changes-are-almost-here-and-why-you/ba-p/2393169).
122+
123+
### My devices connect to a sovereign Azure region. Do I still need to update them?
124+
125+
No, only the [global Azure cloud](https://azure.microsoft.com/global-infrastructure/geographies) is affected by this change. Sovereign clouds aren't included in this migration.
126+
127+
### I use IoT Central. Do I need to update my devices?
128+
129+
Yes, IoT Central uses both IoT Hub and DPS in the backend. The TLS migration will affect your solution, and you need to update your devices to maintain connection.
130+
131+
### How long will it take my devices to reconnect?
132+
133+
Several factors can affect device reconnection behavior.
134+
135+
Devices are configured to reverify their connection at a specific interval. The default in the Azure IoT SDKs is to reverify every 45 minutes. If you've implemented a different pattern in your solution, then your experience may vary.
136+
137+
Also, as part of the migration, your IoT hub may get a new IP address. If your devices use a DNS server to connect to IoT hub, it can take up to an hour for DNS servers to refresh with the new address. For more information, see [IoT Hub IP addresses](iot-hub-understand-ip-address.md).
138+
139+
## Troubleshoot
140+
141+
### Troubleshoot the self-migration tool
142+
143+
If you're using the CLI commands to migrate to a new root certificate and receive an error that `root-authority` isn't a valid command, make sure that you're running the latest version of the **azure-iot** extension.
144+
145+
1. Use `az extension list` to verify that you have the correct extension installed.
146+
147+
```azurecli
148+
az extension list
149+
```
150+
151+
This article uses the newest version of the Azure IoT extension, called `azure-iot`. The legacy version is called `azure-cli-iot-ext`. You should only have one version installed at a time.
152+
153+
Use `az extension remove --name azure-cli-iot-ext` to remove the legacy version of the extension.
154+
155+
Use `az extension add --name azure-iot` to add the new version of the extension.
156+
157+
1. Use `az extension update` to install the latest version of the **azure-iot** extension.
158+
159+
```azurecli
160+
az extension update --name azure-iot
161+
```
162+
163+
### Troubleshoot device reconnection
164+
165+
If you're experiencing general connectivity issues with IoT Hub, check out these troubleshooting resources:
166+
167+
* [Connection and retry patterns with device SDKs](iot-hub-reliability-features-in-sdks.md#connection-and-retry).
168+
* [Understand and resolve Azure IoT Hub error codes](troubleshoot-error-codes.md).
169+
170+
If you're watching Azure Monitor after migrating certificates, you should look for a DeviceDisconnect event followed by a DeviceConnect event, as demonstrated in the following screenshot:
171+
172+
:::image type="content" source="./media/migrate-tls-certificate/monitor-device-disconnect-connect.png" alt-text="Screenshot of Azure Monitor logs showing DeviceDisconnect and DeviceConnect events.":::
173+
174+
If your device disconnects but doesn't reconnect after the migration, try the following steps:
175+
176+
* Check that your DNS resolution and handshake request completed without any errors.
177+
178+
* Verify that the device has both the DigiCert Global Root G2 certificate and the Baltimore certificate installed in the certificate store.
179+
180+
* Use the following Kusto query to identify connection activity for your devices. For more information, see [Kusto Query Language (KQL) overview](/azure/data-explorer/kusto/query/).
181+
182+
```kusto
183+
AzureDiagnostics
184+
| where ResourceProvider == "MICROSOFT.DEVICES" and ResourceType == "IOTHUBS"
185+
| where Category == "Connections"
186+
| extend parsed_json = parse_json(properties_s)
187+
| extend SDKVersion = tostring(parsed_json.sdkVersion), DeviceId = tostring(parsed_json.deviceId), Protocol = tostring(parsed_json.protocol)
188+
| distinct TimeGenerated, OperationName, Level, ResultType, ResultDescription, DeviceId, Protocol, SDKVersion
189+
```
190+
191+
* Use the **Metrics** tab of your IoT hub in the Azure portal to track the device reconnection process. Ideally, you should see no change in your devices before and after you complete this migration. One recommended metric to watch is **Connected Devices**, but you can use whatever charts you actively monitor.

0 commit comments

Comments
 (0)