Search code examples
azure-web-app-serviceazure-application-settings

Azure App Service application settings reverted when updating container image


I have a web app hosted in Azure with a linux container with image stored in azure container registry. The web app is working fine and I have a couple of Application settings configured. One of the settings is : WEBSITES_ENABLE_APP_SERVICE_STORAGE = TRUE

However, when I update the container image this specific application setting reverts to false.

I have tried removing the setting and adding it again both via portal and az cli but still no success with keeping the value TRUE after update. Under Diagnose and solve problems -> Web App restarted -> I can see the following message: Your application was recycled as application environment variables changed. This can most likely occur due to update in app settings or swap operation. But no explanation why its reverted back to false.

Command for updating the container image

az webapp config container set \
--docker-custom-image-name "DOCKER|xx.azurecr.io/imagename:tag" \
--docker-registry-server-password topsecret \
--docker-registry-server-url https://index.docker.io \
--docker-registry-server-user username \
--name MyWebApp \
--resource-group MyResourceGroup

The command is successful and returns the following:

  {
    "name": "WEBSITES_ENABLE_APP_SERVICE_STORAGE",
    "slotSetting": false,
    "value": "false"
  },

When I update with a new image I want the application setting WEBSITES_ENABLE_APP_SERVICE_STORAGE = TRUE and not revert to false as it does right now. I am not using slot settings but I have tried setting both value and slotSetting to True but still no change.


Solution

  • Solution for this problem is the following: The commando az webapp config container set has an option to set the storage for the container to True (Being by default False)

    The parameter thats need to be added to the command is --enable-app-service-storage -t

    Tried and verified that it works, output is now the following:

      {
        "name": "WEBSITES_ENABLE_APP_SERVICE_STORAGE",
        "slotSetting": false,
        "value": "true"
      },
    

    If the parameter is not provided the command will override your current app settings.

    https://learn.microsoft.com/en-us/cli/azure/webapp/config/container?view=azure-cli-latest