'YAML-based deployment not working from ADO, can do a manual deploy from VS Code
I am building a yaml-based release pipeline to deploy an app service from ADO to Azure App Services. I can perform a manual deploy and all of the code deploys as a zip and then it works with WEBSITE_RUN_FROM_PACKAGE="1".
for example from VS Code: az webapp config appsettings set --resource-group RGP --name sitename --settings WEBSITE_RUN_FROM_PACKAGE="1"
az webapp deployment source config-zip --resource-group RGP --name sitename --src sitename.zip
It returns
"author": "N/A",
"author_email": "N/A",
"complete": true,
"deployer": "ZipDeploy",
"end_time": "2022-02-02T04:28:38.6143958Z",
"id": "xxx",
"is_readonly": true,
"is_temp": false,
"last_success_end_time": "2022-02-02T04:28:38.6143958Z",
"log_url": "https://sitename.scm.azurewebsites.net/api/deployments/latest/log",
"message": "Created via a push deployment",
"progress": "",
"provisioningState": "Succeeded",
"received_time": "2022-02-02T04:28:10.9806495Z",
"site_name": "sitename",
"start_time": "2022-02-02T04:28:11.3244119Z",
"status": 4,
"status_text": "",
"url": "https://sitename.scm.azurewebsites.net/api/deployments/latest"
However, in my YAML release, I am using the following, and it both over-writes WEBSITE_RUN_FROM_PACKAGE="1" and won't run with or without that value added after the fact. It return a site permission error. Here is the relevant YAML section. I'm wondering if I need to use deployer: zipDeploy somehow, based on the above success and the below failing even though it puts the same zip file in the wwwroot dir of the app service. FYI - I am using terraform to provision the site and Configuration Items and then running the deploy afterwards.
- stage: deploy
dependsOn: [infrastructure]
displayName: DEPLOY APP
jobs:
# Track deployments on the environment.
- deployment: DeployWeb
displayName: deploy Web App
pool:
vmImage: 'windows-latest'
# Creates an environment if it doesn't exist.
environment: '$(workstream)-$(env_identifier)'
strategy:
# Default deployment strategy
runOnce:
deploy:
steps:
- checkout: self
- bash: ls $BUILD_ARTIFACTSTAGINGDIRECTORY
- bash: ls $PIPELINE_WORKSPACE
- task: AzureRmWebAppDeployment@4
displayName: 'deploy $(tier_prefix)-$(region_prefix)-$(workstream)-UI-01'
inputs:
ConnectionType: 'AzureRM'
azureSubscription: 'subname'
# SlotName: 'slot'
appType: 'webApp'
WebAppName: '$(tier_prefix)-$(region_prefix)-$(workstream)-UI-01'
ResourceGroupName: 'XZ$(region_prefix)-E-N-$(rgp_identifier)-$(tier_prefix)-RGP-10'
# DeployToSlotOrASEFlag: true
Package: '$(Pipeline.Workspace)/build/eu-web-$(workstream)/'
UseWebDeploy: true
enableCustomDeployment: true
deploymentMethod: runFromPackage
ExcludeFilesFromAppDataFlag: false
TakeAppOfflineFlag: false
removeAdditionalFilesFlag: true
additionalArguments: '-useCheckSum'
Solution 1:[1]
Here was my solution, so far it seems to work.
I completely dropped everything around UseWebDeploy
UseWebDeploy: true
enableCustomDeployment: true
deploymentMethod: runFromPackage
ExcludeFilesFromAppDataFlag: false
TakeAppOfflineFlag: false
removeAdditionalFilesFlag: true
additionalArguments: '-useCheckSum'
and change this
Package: '$(Pipeline.Workspace)/build/eu-web-$(workstream)/'
to this
Package: '$(Pipeline.Workspace)/build/eu-web-$(workstream)/eu-web-$(workstream)-$(env_identifier).zip'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Chris Wright |
