Skip to content

xFileSystemAccessRule: "The security identifier is not allowed to be the owner of this object." #3

@oleksii-iaroshchuk

Description

@oleksii-iaroshchuk

I have the following simple rule to give "Modify" permission on the directory:

File WorkerRoleContent
{
    Ensure          = "Present"            
    DestinationPath = $workerRoleContentDir
    Type            = "Directory"    
}
xFileSystemAccessRule WorkerRoleContent
{
    DependsOn       = "[File]WorkerRoleContent"
    Path            = $workerRoleContentDir
    Identity        = $appUserName
    Rights          = "Modify"
    Ensure          = "Present"
}

When I apply this DSC configuration to clean system (no directory exists), everything works fine.
But when applying it on VM with already existing directory, I have the following error:

The security identifier is not allowed to be the owner of this object.

Googling a bit gave some results for Powershell Set-Acl cmdlet: http://www.mickputley.net/2015/11/set-acl-security-identifier-is-not.html
So, for now I implemented the following workaround using a Script resource:

Script WorkerRoleContent
{
    DependsOn = "[File]WorkerRoleContent"
    SetScript = {                
        $acl = (Get-Item $using:workerRoleContentDir).GetAccessControl('Access')
        $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($using:appUserName, 
            "Modify", "ContainerInherit, ObjectInherit", "None", "Allow")
        $acl.SetAccessRule($accessRule)
        Set-ACL $using:workerRoleContentDir $acl
    }
    TestScript = { 
        return $false 
    }
    GetScript = {
        @{ Result = "WorkerRoleContent directory" }
    }
}

As stated in refrenced article, main idea is to use (Get-Item $FolderPath).GetAccessControl('Access') instead of Get-ACL $FolderPath.

It seems like such fix must be used inside of xFileSystemAccessRule resource.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThe issue is a bug.high priorityThe issue or PR should be resolved first. It is of less priority than the label 'Blocking Release'.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions