您的位置:首页 > 博客中心 > APP开发 >

【Azure 应用服务】App Service 配置 Application Settings 访问Storage Account得到 could not be resolved: '*.file.core.windows.net'的报错。没有解析成对应中国区 Storage Account地址 *.file.core.chinacloudapi.cn

时间:2022-09-07 11:14

问题描述

App Service 配置 Application Settings 访问Storage Account。如下:

 {
    "name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
    "value": "[concat(‘DefaultEndpointsProtocol=https;AccountName=‘,parameters(‘storageName‘),‘;AccountKey=‘,listKeys(variables(‘storageResourceId‘), ‘2015-05-01-preview‘).key1)]"
 }

得到 Could not be resolved: ‘*.‘的报错

问题解决

因为应用部署在中国区的App Service上,访问的Storage Account也是中国区的资源,所以如果Host 需要为 file.core.chinacloudapi.cn。 而以上的配置方式默认自动后去的是Global获取的Endpoint。中国区的Endpoint需要加上EndpointSuffix。有两种配置方式:

方式一:直接写EndpointSuffix=core.chinacloudapi.cn

[concat(‘DefaultEndpointsProtocol=https;AccountName=‘, variables(‘storageAccountName‘), ‘;EndpointSuffix=core.chinacloudapi.cn‘, ‘;AccountKey=‘,listKeys(resourceId(‘Microsoft.Storage/storageAccounts‘, variables(‘storageAccountName‘)), ‘2019-06-01‘).keys[0].value)]

 

方式二:使用 EndpointSuffix=environment().suffixes.storage

[concat(‘DefaultEndpointsProtocol=https;AccountName=‘, variables(‘storageAccountName‘), ‘;EndpointSuffix=‘, environment().suffixes.storage, ‘;AccountKey=‘,listKeys(resourceId(‘Microsoft.Storage/storageAccounts‘, variables(‘storageAccountName‘)), ‘2019-06-01‘).keys[0].value)]

 

技术图片

 

 

参考资料

Environment() [This function returns properties for the current Azure environment.]

 

相关推荐

电脑软件

本类排行

今日推荐

热门手游