Doubts about the SDK usage and implementation mechanism of eventhub

Sun Tongxin3 20 Reputation points
2024-04-02T09:03:46.21+00:00

Use Azure SDK in China. Accessing the eventhub through AAD,In the code, when the ClientSecretCredential does not specify the China region, it can be seen through packet capture that there is access to the global endpoint. However, it is strange that the program can run normally, and it is necessary to understand the reason why it can run normally.User's image

User's image

From the packet capture results, it seems that it was redirected to the China region after accessing Global. Is there any explanation about this unique mechanism? I need to use it in a restricted network, but during the investigation, I found that it can run successfully without specifying a multi cloud environment.

Azure Event Hubs
Azure Event Hubs
An Azure real-time data ingestion service.
591 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ShaikMaheer-MSFT 38,321 Reputation points Microsoft Employee
    2024-04-02T16:47:48.5233333+00:00

    Hi Sun Tongxin3,

    It is possible that the Azure SDK is using Azure's global endpoint by default, and then being redirected to the China region endpoint based on the location of the Azure subscription. This is because Azure has a global infrastructure that automatically routes traffic to the appropriate region based on the location of the subscription.

    When you create an Azure subscription in China, it is automatically associated with the Azure China cloud, which has its own set of endpoints and APIs. When you use the Azure SDK to access resources in China, it automatically routes the traffic to the China region endpoint based on the location of the subscription.

    In your case, it is possible that the Azure SDK is using the global endpoint by default, but then being redirected to the China region endpoint based on the location of the subscription. This is why your program is able to run normally without specifying a multi-cloud environment.

    However, it is recommended to specify the China region when using the Azure SDK in China to ensure that the traffic is routed to the correct endpoint and to avoid any potential issues with network restrictions. You can specify the China region by setting the AzureEnvironment.AzureChinaCloud environment variable or by using the Azure.ChinaCloud endpoint in your code.