I want to apply a security patch to a an existing Sitecore 10.4 Azure-based environment. I want to deploy it as an zip file and patches should get applied there, we are creating a azure release task for it. We used a publish AZWebapp but it is overriding the existing file structure and deleting the existing files. We don't want to deploy a single file by extracting via webdeploy or Kudu API. Any thoughts?
1 Answer
Yep—this is a classic gotcha with the Azure App Service Deploy task: by default it can clean the target (msdeploy “remove additional files”), which nukes anything that isn’t in your artifact.
Use Web Deploy but disable deletes
In the “Azure App Service deploy” task (the one that uses msdeploy):
Uncheck: Remove additional files at destination
(Optional) Check: Take App Offline (or touch web.config) to ensure DLLs swap cleanly
Additional Deployment Options → Additional arguments:
-useChecksum -enableRule:DoNotDeleteRule -retryAttempts:2
This makes msdeploy only add/overwrite files from your patch zip and not delete anything else.
- task: AzureRmWebAppDeployment@4
displayName: 'Deploy Sitecore patch (no delete)'
inputs: appType: webApp
ConnectionType: 'AzureRM' azureSubscription: 'My Azure SPN' WebAppName: 'my-sitecore-cm' packageForLinux: '$(Pipeline.Workspace)/drop/patch.zip' # your patch zip enableCustomDeployment: true RemoveAdditionalFilesFlag: false # critical TakeAppOfflineFlag: true