An Azure service that provides an event-driven serverless compute platform.
Hello !
Thank you for posting on MS Learn Q&A.
The issue is almost certainly the structure of publish.zip not the az webapp deploy command.
Azure/Kudu extracts the ZIP exactly as packaged into wwwroot, it does not flatten the folder structure.
ZIP deploy unpacks the package contents into D:\home\site\wwwroot or /home/site/wwwroot for App Service and for Azure Functions the ZIP must have host.json at the root after extraction. If the parent folder is included, Azure will not find the expected files in wwwroot.
https://learn.microsoft.com/en-us/azure/app-service/deploy-zip
So this is wrong:
zip -r publish.zip publish
That creates:
publish/
host.json
MyFunctionApp.dll
...
Azure extracts it as:
wwwroot/publish/...
Instead, zip the contents of the publish folder:
script:
- dotnet publish -c Release -o publish
- cd publish
- zip -r ../publish.zip .
- cd ..
- az webapp deploy --resource-group <groupName> --name <appName> --src-path publish.zip --type zip
For Windows PS :
dotnet publish -c Release -o publish
Compress-Archive -Path .\publish\* -DestinationPath .\publish.zip -Force
az webapp deploy --resource-group <groupName> --name <appName> --src-path .\publish.zip --type zip
You can verify before deploying:
unzip -l publish.zip | head
You should see files directly at the root, for example:
host.json
MyApp.dll
web.config
Not:
publish/host.json
publish/MyApp.dll
If this is an Azure Function App, I would also prefer the Functions specific command:
az functionapp deployment source config-zip \
--resource-group <groupName> \
--name <appName> \
--src publish.zip