0
votes

I'm using VSTS to deploy a azure cloud service package and getting a file access issue for web.config not able to be written to after a successful deployment.

At the moment I manually set the file permission via RDP to correct it for eg. on e:\siteroot\1\Web.config (Everyone FC)

To avoid this manual step - how can I set a folder/file permission for a file under cloud service deployment.

2

2 Answers

0
votes

You can create a .bat file where you call the icacls command with the parameters you prefer:

How to grant permission to users for a directory using command line in Windows?

and then you can configure a startup task for your cloud service to run this file:

https://docs.microsoft.com/en-us/azure/cloud-services/cloud-services-startup-tasks

0
votes

The issue seems not related to azure projects directly. It's not suggest to give a permission with Everyone FC, this may cause security risk.

For Azure Cloud Services Web Roles, the default Application Pool Identity account is “Network Service”.

In a normal basis the Application Pool account needs read permission over the web.config file so it can read all the application configuration. enter image description here

For this kind of issue, you could creating a Startup Task to give write permission to Network Service in the application Web.config file.

Please go through the detail steps in this similar issue: Error “Access to the path ‘E:sitesrootWeb.config’ is denied” when storing Azure AD’s public key in Web.config of an Azure Cloud Services application.

Also take a look at this related question: Web.config Access denied when Package Azure cloud services projects in Visual Studio 2013 for Web