If you are deploying from Visual Studio you will need to alter your project file to prevent Web Deploy changing the permissions.
To accomplish this, simply navigate to your project and find the file with the extension .csproj
Find the section which looks similar to as follows:
<propertygroup condition=” ‘$(Configuration)|$(Platform)’ ==’Release|AnyCPU’ “> </propertygroup>
Then include this element:
If you placed your <includesetaclproviderondestination> within the ‘Release|AnyCPU’ section but built your project within the Debug configuration, then the <includesetaclproviderondestination> attribute may not invoke on the production server. To make sure your permission is not altered create the <includesetaclproviderondestination> attribute on both the ‘Release|AnyCPU’ and ‘Debug|AnyCPU’ group of your project file.
If you are deploying from Azure DevOps, then include the following within the MSBuild Arguements: