Develop Endpoint for China Azure

经常碰到客户给我们上ticket,表示他们无法链接China Azure(Mooncake)的service endpoint。在这类问题中,我们看到最多的报错是:"Unresolved DNS name"。

造成这类错误的原因是,我们在创建client的时候,需要显式的指定链接service的endpoint suffix,因为by default 是链接global azure的。

拿Azure Storage 举例来说:

Global Azure的连接串如下:

public static final String storageConnectionString = "DefaultEndpointsProtocol=https;"
            + "AccountName=<account name>;"
            + "AccountKey=<account key>";

但在连接China Azure(Mooncake)则需要显示指定endpoint suffix:

public static final String storageConnectionString = "DefaultEndpointsProtocol=https;"
            + "AccountName=<account name>;"
            + "AccountKey=<account key>;"
            + "EndpointSuffix=core.chinacloudapi.cn";

因此强烈推荐China Azure新入门客户阅读下面两篇文档:

  1. Developer Notes for Azure in China Applications
  2. API endpoints of Office 365 operated by 21Vianet
原文地址:https://www.cnblogs.com/xingzhou/p/6038427.html