An Azure service that provides an event-driven serverless compute platform.
Do not clean /home/data/SitePackages before each deployment; leave the directory under the deployment service’s control, and never delete packagename.txt or the ZIP file it identifies as active.
Expected behavior
For a Linux Function App on a Premium or Dedicated plan with WEBSITE_RUN_FROM_PACKAGE=1:
- ZIP deployment stores the package in
/home/data/SitePackages. -
packagename.txtcontains the name of the package that the runtime mounts. - That selected ZIP is mounted as the read-only
wwwroot. - Other timestamp-named ZIP files are inactive deployment artifacts; their presence does not cause them to execute. ^1^
Therefore, seeing several ZIP files alongside packagename.txt, as in the screenshot, is not by itself an error.
You can identify the active package without changing anything:
cd /home/data/SitePackages
active="$(tr -d '\r\n' < packagename.txt)"
printf 'Active package: %s\n' "$active"
test -f "$active" && echo "Active package exists" ||
echo "ERROR: Active package is missing"
Retention and cleanup
Microsoft’s public deployment documentation does not specify a supported age-based retention period, fixed maximum package count, or schedule for inactive ZIPs in SitePackages. Consequently:
- Do not assume old ZIPs will disappear after a particular number of days.
- Do not build capacity or rollback procedures around an observed number such as five packages.
- Multiple packages may remain after deployments.
- Any platform pruning behavior should be treated as an implementation detail, not a retention guarantee.
The documentation’s statement that ZIP deployment deletes files from previous deployments concerns deployment content management; it does not document a retention contract for package archives in SitePackages. ^1^
Manual deletion
Routine manual deletion is not recommended because deleting the package named by packagename.txt leaves the runtime pointing to a missing package and can prevent the application from mounting or starting. The package and selector file together form the active deployment state. App Service documents that packagename.txt identifies the ZIP loaded at runtime. ^2^
If accumulated packages create an actual storage-capacity problem:
- Stop automated deployments temporarily so cleanup cannot race with a deployment.
- Read
packagename.txt. - Verify that the named ZIP exists.
- Preserve both
packagename.txtand that active ZIP. - Preserve any inactive package required by your own rollback process.
- Delete only confirmed inactive
*.zipfiles. - Restart the app and verify host startup and representative functions.
This is an operational workaround rather than a documented Azure retention procedure. For production automation, open an Azure support request to confirm the behavior for the app’s hosting plan and deployment task before adding deletion logic to the pipeline.
Security implications
Only the ZIP selected by packagename.txt is mounted and executed, so an inactive package containing vulnerable dependencies is not an additional running copy of the application. It should still be treated as a sensitive deployment artifact because it may contain source code, binaries, or configuration accidentally included during packaging.
Apply normal controls:
- Restrict Azure RBAC and SCM/Kudu access.
- Do not package secrets or local configuration files.
- Keep the active deployment patched.
- Remove inactive artifacts when required by an organizational data-retention policy, using the guarded procedure above.
Confirm the hosting plan
WEBSITE_RUN_FROM_PACKAGE=1 with local /home/data/SitePackages is documented for Linux Premium and Dedicated Function Apps. Linux Consumption uses remote build or an external package URL, while Flex Consumption uses managed package deployment and should not set WEBSITE_RUN_FROM_PACKAGE. ^1^
If this app is Linux Consumption or Flex Consumption, the current configuration should be reviewed rather than treating this directory as the supported package-management model.
References