Thursday, January 23, 2020

Check File Permission for App Service Files in Azure


Below is the permissions output of files in the wwwroot directory that I ran with a Powershell command in Kudu site. So if you ever see the issue again and you ensure stdoutLogFile="\\?\%home%\LogFiles\stdout" but still have issues, you may compare your Powershell permissions output of your wwwroot directory to mine to see if they have same access control:

You should use this when your web application isn't starting and giving you the permission error. 

Navigate to your Kudu site (yourApp.scm.azurewebsites.net) --> Debug Console --> PowerShell --> navigate to wwwroot directory





(Run the PS command below to show all files access control and pipe output to avoid PS truncation of the results)

Dir | Get-Acl | Format-List

You can compare your output to mine:
F

PS D:\home\site\wwwroot> Dir | Get-Acl | Format-List
Dir | Get-Acl | Format-List​
Path   : Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\wwwroot​
Owner  : O:S-1-5-21-2996674325-4160296812-1073090115-501​
Group  : G:S-1-5-21-2996674325-4160296812-1073090115-513​
Access : Everyone Allow  DeleteSubdirectoriesAndFiles, Modify, Synchronize​
         BUILTIN\Administrators Allow  FullControl​
Audit  : ​
Sddl   : O:S-1-5-21-2996674325-4160296812-1073090115-501G:S-1-5-21-2996674325-4​
         160296812-1073090115-513D:AI(A;OICIID;0x1301ff;;;WD)(A;OICIID;FA;;;BA)​
Path   : Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\appsettings​
         .Development.json​
Owner  : O:S-1-5-21-2996674325-4160296812-1073090115-501​
Group  : G:S-1-5-21-2996674325-4160296812-1073090115-513​
Access : Everyone Allow  DeleteSubdirectoriesAndFiles, Modify, Synchronize​
         BUILTIN\Administrators Allow  FullControl​
Audit  : ​
Sddl   : O:S-1-5-21-2996674325-4160296812-1073090115-501G:S-1-5-21-2996674325-4​
         160296812-1073090115-513D:AI(A;ID;0x1301ff;;;WD)(A;ID;FA;;;BA)​
Path   : Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\appsettings​
         .json​
Owner  : O:S-1-5-21-2996674325-4160296812-1073090115-501​
Group  : G:S-1-5-21-2996674325-4160296812-1073090115-513​
Access : Everyone Allow  DeleteSubdirectoriesAndFiles, Modify, Synchronize​
         BUILTIN\Administrators Allow  FullControl​
Audit  : ​
Sddl   : O:S-1-5-21-2996674325-4160296812-1073090115-501G:S-1-5-21-2996674325-4​
         160296812-1073090115-513D:AI(A;ID;0x1301ff;;;WD)(A;ID;FA;;;BA)​
Path   : Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\hostingstar​
         t.html​
Owner  : BUILTIN\Administrators​
Group  : G:S-1-5-21-2996674325-4160296812-1073090115-513​
Access : Everyone Allow  DeleteSubdirectoriesAndFiles, Modify, Synchronize​
         BUILTIN\Administrators Allow  FullControl​
Audit  : ​
Sddl   : O:BAG:S-1-5-21-2996674325-4160296812-1073090115-513D:AI(A;ID;0x1301ff;​
         ;;WD)(A;ID;FA;;;BA)​
Path   : Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\web.config​
Owner  : O:S-1-5-21-2996674325-4160296812-1073090115-501​
Group  : G:S-1-5-21-2996674325-4160296812-1073090115-513​
Access : Everyone Allow  DeleteSubdirectoriesAndFiles, Modify, Synchronize​
         BUILTIN\Administrators Allow  FullControl​
Audit  : ​
Sddl   : O:S-1-5-21-2996674325-4160296812-1073090115-501G:S-1-5-21-2996674325-4​
         160296812-1073090115-513D:AI(A;ID;0x1301ff;;;WD)(A;ID;FA;;;BA)​
Path   : Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\WebApplicat​
         ion4.deps.json​
Owner  : O:S-1-5-21-2996674325-4160296812-1073090115-501​
Group  : G:S-1-5-21-2996674325-4160296812-1073090115-513​
Access : Everyone Allow  DeleteSubdirectoriesAndFiles, Modify, Synchronize​
         BUILTIN\Administrators Allow  FullControl​
Audit  : ​
Sddl   : O:S-1-5-21-2996674325-4160296812-1073090115-501G:S-1-5-21-2996674325-4​
         160296812-1073090115-513D:AI(A;ID;0x1301ff;;;WD)(A;ID;FA;;;BA)​
Path   : Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\WebApplicat​
         ion4.dll​
Owner  : O:S-1-5-21-2996674325-4160296812-1073090115-501​
Group  : G:S-1-5-21-2996674325-4160296812-1073090115-513​
Access : Everyone Allow  DeleteSubdirectoriesAndFiles, Modify, Synchronize​
         BUILTIN\Administrators Allow  FullControl​
Audit  : ​
Sddl   : O:S-1-5-21-2996674325-4160296812-1073090115-501G:S-1-5-21-2996674325-4​
         160296812-1073090115-513D:AI(A;ID;0x1301ff;;;WD)(A;ID;FA;;;BA)​
Path   : Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\WebApplicat​
         ion4.pdb​
Owner  : O:S-1-5-21-2996674325-4160296812-1073090115-501​
Group  : G:S-1-5-21-2996674325-4160296812-1073090115-513​
Access : Everyone Allow  DeleteSubdirectoriesAndFiles, Modify, Synchronize​
         BUILTIN\Administrators Allow  FullControl​
Audit  : ​
Sddl   : O:S-1-5-21-2996674325-4160296812-1073090115-501G:S-1-5-21-2996674325-4​
         160296812-1073090115-513D:AI(A;ID;0x1301ff;;;WD)(A;ID;FA;;;BA)​
Path   : Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\WebApplicat​
         ion4.runtimeconfig.json​
Owner  : O:S-1-5-21-2996674325-4160296812-1073090115-501​
Group  : G:S-1-5-21-2996674325-4160296812-1073090115-513​
Access : Everyone Allow  DeleteSubdirectoriesAndFiles, Modify, Synchronize​
         BUILTIN\Administrators Allow  FullControl​
Audit  : ​
Sddl   : O:S-1-5-21-2996674325-4160296812-1073090115-501G:S-1-5-21-2996674325-4​
         160296812-1073090115-513D:AI(A;ID;0x1301ff;;;WD)(A;ID;FA;;;BA)​
Path   : Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\WebApplicat​
         ion4.Views.dll​
Owner  : O:S-1-5-21-2996674325-4160296812-1073090115-501​
Group  : G:S-1-5-21-2996674325-4160296812-1073090115-513​
Access : Everyone Allow  DeleteSubdirectoriesAndFiles, Modify, Synchronize​
         BUILTIN\Administrators Allow  FullControl​
Audit  : ​
Sddl   : O:S-1-5-21-2996674325-4160296812-1073090115-501G:S-1-5-21-2996674325-4​
         160296812-1073090115-513D:AI(A;ID;0x1301ff;;;WD)(A;ID;FA;;;BA)​
Path   : Microsoft.PowerShell.Core\FileSystem::D:\home\site\wwwroot\WebApplicat​
         ion4.Views.pdb​
Owner  : O:S-1-5-21-2996674325-4160296812-1073090115-501​
Group  : G:S-1-5-21-2996674325-4160296812-1073090115-513​
Access : Everyone Allow  DeleteSubdirectoriesAndFiles, Modify, Synchronize​
         BUILTIN\Administrators Allow  FullControl​
Audit  : ​
Sddl   : O:S-1-5-21-2996674325-4160296812-1073090115-501G:S-1-5-21-2996674325-4​
         160296812-1073090115-513D:AI(A;ID;0x1301ff;;;WD)(A;ID;FA;;;BA)