WebDeploy with ARM templates to Azure Functions failing with ERROR_INSUFFICIENT_ACCESS_TO_SITE_FOLDER

0

I'm trying to deploy an Azure Function app (.NET Core, functions v3) with MSDeploy using an ARM template, and I keep getting this error almost every time. This only succeeds occasionally. My function app has 5 functions that are timer-based, running every second. I'm currently using deployment slots, and I have my functions set to disabled when they're in the staging slot (via the DisabledAttribute and slot-specific setting).

ARM template I'm using to deploy:

{
            "apiVersion": "2018-02-01",
            "name": "[concat(variables('webAppName'), '/staging')]",
            "type": "Microsoft.Web/sites/slots",
            "kind": "app",
            "location": "[resourceGroup().location]",
            "resources": [
                {
                    "apiVersion": "2015-02-01",
                    "type": "Extensions",
                    "name": "MSDeploy",
                    "dependsOn": [
                        "[concat(resourceId('Microsoft.Web/Sites/', variables('webAppName')), '/slots/staging')]"
                    ],
                    "properties": {
                        "packageUri": "[parameters('packageUrl')]"
                    }
                }
            ]
        }

ARM-MSDeploy Deploy Failed: 'Microsoft.Web.Deployment.DeploymentDetailedUnauthorizedAccessException: Unable to perform the operation ("Delete File") for the specified directory ("D:\home\site\wwwroot\bin\MyAssembly.dll"). This can occur if the server administrator has not authorized this operation for the user credentials you are using. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_INSUFFICIENT_ACCESS_TO_SITE_FOLDER. ---> Microsoft.Web.Deployment.DeploymentException: The error code was 0x80070005. ---> System.UnauthorizedAccessException: Access to the path 'D:\home\site\wwwroot\bin\MyAssembly.dll' is denied.

How do I stop this error from happening?

azure-functions
asked on Stack Overflow Aug 12, 2020 by madeleine • edited Aug 14, 2020 by madeleine

1 Answer

0

Please refer to this thread for the similar issue.

You need to add appOfline parameter and set it true as mentioned in this article

    {
  "apiVersion": "2016-08-01",
  "name": "MSDeploy",
  "type": "Extensions",
  "properties": {
    "packageUri": "https://storage.blob.core.windows.net/artifacts/package.zip",
    "appOffline": true
  }

Hope the above helps to resolve your issue.

answered on Stack Overflow Aug 28, 2020 by MayankBargali-MSFT

User contributions licensed under CC BY-SA 3.0