Skip to content

Fix: Support Azure China (21Vianet) hostname validation for IoT Hub and EventHub#729

Open
apciala wants to merge 1 commit into
Azure:mainfrom
apciala:fix/azure-china-hostname-validation
Open

Fix: Support Azure China (21Vianet) hostname validation for IoT Hub and EventHub#729
apciala wants to merge 1 commit into
Azure:mainfrom
apciala:fix/azure-china-hostname-validation

Conversation

@apciala
Copy link
Copy Markdown

@apciala apciala commented May 7, 2026

Summary

PR #720 introduced strict hostname validation that hardcodes .azure-devices.net and .servicebus.windows.net as the only allowed domain suffixes, blocking Azure China (21Vianet) IoT Hubs.

Changes

  • validateAzureIoTHostname: Added .azure-devices.cn as allowed domain suffix, updated TLD validation to accept both net and cn
  • validateEventHubHostname: Added .servicebus.chinacloudapi.cn as allowed domain suffix, with proper label validation for China-specific domain structure

Supported Azure China domains

Service Global China (21Vianet)
IoT Hub *.azure-devices.net *.azure-devices.cn
EventHub *.servicebus.windows.net *.servicebus.chinacloudapi.cn

Testing

  • Built and tested on Windows 11 with Azure China IoT Hub connection string (*.azure-devices.cn)
  • Verified IoT Hub connection works
  • Verified telemetry monitoring (EventHub) works

Fixes #728

…nd EventHub

PR Azure#720 introduced strict hostname validation that hardcodes
.azure-devices.net and .servicebus.windows.net as the only allowed
domain suffixes, blocking Azure China (21Vianet) IoT Hubs.

This fix adds support for:
- IoT Hub: .azure-devices.cn
- EventHub: .servicebus.chinacloudapi.cn

Fixes Azure#728
@apciala
Copy link
Copy Markdown
Author

apciala commented May 7, 2026

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Regression: Cannot connect to Azure China IoT Hub (.azure-devices.cn) due to hostname validation

1 participant