碼迷,mamicode.com
首頁 > 移動開發 > 詳細

【Azure 應用服務】App Service 配置 Application Settings 訪問Storage Account得到 could not be resolved: '*.file.core.windows.net'的報錯。沒有解析成對應中國區 Storage Account地址 *.file.core.chinacloudapi.cn

時間:2021-07-26 16:39:52      閱讀:0      評論:0      收藏:0      [點我收藏+]

標簽:rgb   str   hoc   manager   div   turn   中國   lte   sof   

問題描述

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: ‘*.file.core.windows.net的報錯

問題解決

因為應用部署在中國區的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.]https://docs.azure.cn/en-us/azure-resource-manager/templates/template-functions-deployment?tabs=json#environment

 

【Azure 應用服務】App Service 配置 Application Settings 訪問Storage Account得到 could not be resolved: '*.file.core.windows.net'的報錯。沒有解析成對應中國區 Storage Account地址 *.file.core.chinacloudapi.cn

標簽:rgb   str   hoc   manager   div   turn   中國   lte   sof   

原文地址:https://www.cnblogs.com/lulight/p/15054896.html

(0)
(0)
   
舉報
評論 一句話評論(0
登錄后才能評論!
? 2014 mamicode.com 版權所有  聯系我們:gaon5@hotmail.com
迷上了代碼!
4399在线看MV_久久99精品久久久久久久久久_成人又黄又爽又刺激视频_能收黄台的app不收费