There is a local Sitecore 10.3 Docker setup with SXA and SPE (6.4). Component creation fails with access denied powershell error trying to create the view .cshtml file:

New-Item : Access to the path 'TextTeaser' is denied.
At line:194 char:25
+ ...                    New-Item -ItemType Directory -Path $folder > $null
+                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (C:\inetpub\wwwroot\Views\TextTeaser:String) [New-Item], UnauthorizedAccessException
    + FullyQualifiedErrorId : CreateDirectoryUnauthorizedAccessError,Microsoft.PowerShell.Commands.NewItemCommand

What is the right way to grant SXA SPE scripts proper permissions?

  • 1
    Do you have the folder configured as a volume? How do you plan to get the view into source control? Commented Feb 4 at 17:44

2 Answers 2


Dockerfile Permissions:

You may try the below if that works.(This is not a general solution this works in my case)

You can include the necessary permissions directly in your Dockerfile. Add the following lines to the Dockerfile:

# Grant permissions for SXA SPE scripts
RUN New-Item -Path C:\inetpub\wwwroot\YourSitecoreInstance\Website\sitecore\media library -ItemType Directory -Force | Out-Null; `
    $acl = Get-Acl -Path C:\inetpub\wwwroot\YourSitecoreInstance\Website\sitecore\media library; `
    $permission = "IIS_IUSRS","FullControl","Allow"; `
    $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission; `
    $acl.SetAccessRule($accessRule); `
    Set-Acl -Path C:\inetpub\wwwroot\YourSitecoreInstance\Website\sitecore\media library -AclObject $acl

Adjust the path as needed for your specific scenario.


Adding volume configuration as @Michael West suggested in the comments did solve the permission issue.


    - ${LOCAL_DEPLOY_PATH}\website:C:\deploy

Not the answer you're looking for? Browse other questions tagged or ask your own question.