azureazure-functionsazure-cliazure-gov

ARM Template: Incorrect storage endpoint for AppSettings, WEBSITE_CONTENTSHARE


Getting error when deploying Azure function to USGov Arizona using ARM template. Template works in Azure commercial. Error is:

12:34:11 - 12:33:27 PM - Resource Microsoft.Web/sites/config 'SFGovAppService/appsettings' failed with message '{
12:34:11 -   "Code": "BadRequest",
12:34:11 -   "Message": "There was a conflict. The remote name could not be resolved: 'sftestgovstorage.file.core.windows.net'",
12:34:11 -   "Target": null,
12:34:11 -   "Details": [
12:34:11 -     {
12:34:11 -       "Message": "There was a conflict. The remote name could not be resolved: 'sftestgovstorage.file.core.windows.net'"
12:34:11 -     },
12:34:11 -     {
12:34:11 -       "Code": "BadRequest"
12:34:11 -     },
12:34:11 -     {
12:34:11 -       "ErrorEntity": {
12:34:11 -         "ExtendedCode": "01020",
12:34:11 -         "MessageTemplate": "There was a conflict. {0}",
12:34:11 -         "Parameters": [
12:34:11 -           "The remote name could not be resolved: 'sftestgovstorage.file.core.windows.net'"
12:34:11 -         ],
12:34:11 -         "Code": "BadRequest",
12:34:11 -         "Message": "There was a conflict. The remote name could not be resolved: 'sftestgovstorage.file.core.windows.net'"
12:34:11 -       }
12:34:11 -     }
12:34:11 -   ],
12:34:11 -   "Innererror": null
12:34:11 - }'

I have a successfully-deployed file service endpoint at https://sftestgovstorage.file.core.usgovcloudapi.net/, within the same resource group, same location (USGov Arizona).

Based on testing, I know that the error is being caused by the "WEBSITE_CONTENTSHARE" property in the template: ("~" = code that I've removed to shorten this.)

{
  "comments": "Adventos SmartForce Function App Service",
  "type": "Microsoft.Web/sites",
  "kind": "functionapp",
  "name": "[parameters('appServiceName')]",
  "apiVersion": "2016-08-01",
  "location": "[resourceGroup().location]",
  "scale": null,
  "properties": {
    "enabled": true,
    "hostNameSslStates": [
~~~~~~~~~~~~~~
    ],
~~~~~~~~~~~~
  },
  "dependsOn": [
    "[resourceId('Microsoft.Web/serverfarms', parameters('appServicePlanName'))]"
  ],
  "resources": [
    {
      "name": "appsettings",
      "type": "config",
      "apiVersion": "2015-08-01",
      "dependsOn": [
        "[resourceId('Microsoft.Web/sites', parameters('appServiceName'))]"
      ],
      "properties": {
        "AzureWebJobsDashboard": "[concat('DefaultEndpointsProtocol=https;AccountName=', parameters('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountId'), providers('Microsoft.Storage', 'storageAccounts').ApiVersions[0]).keys[0].value)]",
        "AzureWebJobsStorage": "[concat('DefaultEndpointsProtocol=https;AccountName=', parameters('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountId'), providers('Microsoft.Storage', 'storageAccounts').ApiVersions[0]).keys[0].value)]",
        "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING": "[concat('DefaultEndpointsProtocol=https;AccountName=', parameters('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountId'), providers('Microsoft.Storage', 'storageAccounts').ApiVersions[0]).keys[0].value)]",
        "WEBSITE_CONTENTSHARE": "[toLower(deployment().name)]",
        "FUNCTIONS_EXTENSION_VERSION": "~1",
        "WEBSITE_NODE_DEFAULT_VERSION": "6.5.0",
~~~~~~~~~~~~~~~~~~
      }
    }
  ]
},

I do know that AppSetting deployment works because I have been able to deploy this configuration to the government tenant using a PUT REST call (via Fiddler)

The issue/question: To me, the template deployment process in this government tenant appears to be looking for a commercial endpoint (file.core.windows.net). Is there a way I can override/correct this?


Solution

  • WEBSITE_CONTENTAZUREFILECONNECTIONSTRING and WEBSITE_CONTENTSHARE should only be used for Function Apps running in Consumption mode, and Azure Government currently doesn't support Consumption.

    Try simply omitting both these settings altogether.