0

After deploying my Python/React app to Azure Web App using ZIP Deploy, the app fails to start with the following error:

ValueError: Permission code orders_justification_read is defined in PERMISSIONS but is not used in the application

This permission code was present in the previous deployment, but has since been removed. I regenerated the build folder entirely before the new deployment, and I confirmed that:

  • The permission orders_justification_read is no longer referenced anywhere in the current source code.

  • The deployed content under site/wwwroot does not contain any trace of this permission.

Despite this, the app still tries to validate the removed permission during startup, leading to a crash.

Context:

  • We're using a custom build_app.py script that prepares a ZIP with only the necessary files.

  • The deployment is done via Azure DevOps using AzureWebApp@1 with ZIP Deploy mode.

  • The issue seems to indicate that old files might be somehow cached or preserved on the Azure side, even though the uploaded build does not contain the obsolete permission.

Question:

Has anyone encountered similar issues where Azure Web App seems to "remember" or reference code that is no longer present in the deployed wwwroot? Are there known caching behaviours or deployment inconsistencies with ZIP Deploy that could explain this?

Thanks in advance!

1
  • Can you please add more details about the App Environment? Commented Apr 14 at 4:11

1 Answer 1

1

Fixing Azure Web App Startup Issues Caused by Unexpected Permissions After Deployment

When you use ZIP Deploy, it updates the existing files but doesn’t remove any old files or folders that aren’t part of the new ZIP. So even if you’ve deleted something in your source code, it might still be sitting on the server from a previous deployment, causing issues when the app runs.

If you’re using Free or Basic App Service plan, try to upgrade to a higher tier.

Use the below script to clean the existing site/wwwroot folder before deploying your new ZIP package.

- name: Clean existing wwwroot
  uses: azure/appservice-settings@v1
  with:
    app-name: <WebAppName>
    slot-name: 'production'
    settings: |
      SCM_DO_BUILD_DURING_DEPLOYMENT=true
- name: Clean wwwroot via Kudu
  run: |
    curl -X POST "https://<WebAppName>.scm.azurewebsites.net/api/command" \
         -u ${{ secrets.KUDU_USERNAME }}:${{ secrets.KUDU_PASSWORD }} \
         -H "Content-Type: application/json" \
         -d '{"command": "rm -rf /home/site/wwwroot/*"}'

or manually delete the /site/wwwroot folder to make sure no old files are left behind.
follow the below given path

enter image description here

Go to Kudu Debug console -> CMD -> home -> site and you can delete it here.

enter image description here enter image description here enter image description here

Delete all existing file in the wwwroot folder.

Redeploy your application ZIP using Azure CLI or Visual Studio Code.

az webapp deployment source config-zip --resource-group <RsGrp> --name <AppService> --src /path/to/webapp.zip

Check your live app after deployment.

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.