This design implements Azure IoT Hub to manage millions of devices.
Topology: IoT Hub sits in the Spoke VNet (Private Link). Devices connect via the Internet (Public Endpoint) or VPN (Private Endpoint).
+--------------+ +--------------------------+ +--------------+
| IoT Device | | HUB VNet | | SPOKE VNet |
| (Sensor) | | (DNS Resolver) | | (Processor) |
+------+-------+ +------------+-------------+ +------+-------+
| | |
v (MQTT) | (Peering) |
+------+-------+ v v
| IoT Hub | +------------+-------------+ +------+-------+
| (Gateway) |---------->| Private DNS Zone |<----------| Stream |
+--------------+ | (privatelink.azure-devices)| | Analytics |
+--------------------------+ +------+-------+
PRIMARY REGION (East US)
+-----------------------------------------------------------------------+
| HUB VNet: vnet-hub (10.0.0.0/16) |
| +-----------------------+ |
| | Private DNS Zone | |
| +-----------|-----------+ |
| | |
| v (Peering) |
+---------------|-------------------------------------------------------+
|
+---------------|-------------------------------------------------------+
| SPOKE VNet: vnet-iot-spoke (10.1.0.0/16) |
| +-----------------------+ +-----------------------+ |
| | Subnet: Stream | | Subnet: PrivateLink | |
| | [Stream Analytics] |------>| [Private Endpoint] | |
| | | | (10.1.1.5) | |
| +-----------------------+ +-----------|-----------+ |
+-----------------------------------------------|-----------------------+
|
v
+-----------------------+
| IoT Hub |
| (PaaS) |
+-----------------------+
|
| (Failover)
v
SECONDARY REGION (West US)
+-----------------------------------------------------------------------+
| DR SPOKE VNet |
| +-----------------------+ |
| | IoT Hub (DR) | |
| +-----------------------+ |
+-----------------------------------------------------------------------+
* IoT Hub supports cross-region failover.
* Initiate failover in Portal.
* Devices reconnect to the same hostname (DNS updates to West US IP).
1. Device: Sends MQTT message {"temp": 105}.
2. IoT Hub: Acknowledges receipt.
3. Route: Routes message to "Hot Path" (Stream Analytics).
4. Process: Stream Analytics sees value > 100.
5. Action: Writes alert to SQL DB.
1. Search: "IoT Hub" -> + Create.
2. Resource Group: rg-iot-spoke.
3. IoT Hub Name: iothub-corp-[uniqueid].
4. Region: East US.
5. Tier: S1: Standard (Required for Private Link).
6. Daily message limit: 400,000 (Default).
7. Create.
1. Go to the IoT Hub -> Devices (Left Menu).
2. + Add Device.
3. Device ID: sensor-01.
4. Authentication type: Symmetric Key.
5. Save.
6. Click on sensor-01.
7. Copy the Primary Connection String.
1. Open Cloud Shell (Bash).
2. Install extension: az extension add --name azure-iot.
3. Run simulation:
* az iot device simulate -d sensor-01 -n iothub-corp-[uniqueid]
4. Output: You should see "Sending message: {"temperature": 25.5...}".
5. Keep this running.
1. Go to IoT Hub -> Networking.
2. Public network access: Select Disabled (or Selected networks if you want to keep Cloud Shell working).
* *Note: If you Disable, the Cloud Shell simulation will fail unless Cloud Shell is VNet integrated.*
3. Private endpoint connections -> + Private endpoint.
4. Name: pe-iothub.
5. Resource Group: rg-iot-spoke.
6. Target sub-resource: iotHub.
7. Virtual Network: vnet-iot-spoke.
8. Subnet: snet-privatelink.
9. Integrate with private DNS zone: Yes.
* Zone: privatelink.azure-devices.net.
10. Create.
1. Login to a VM in the Spoke VNet.
2. Nslookup: nslookup iothub-corp-[uniqueid].azure-devices.net.
* Result: 10.1.x.x (Private IP).
3. Run Simulation: Run a python script or the az iot command from *inside* the VM. It will connect via Private Link.