I have presented some SAN storage to a server and created a mount point using Disk Management in Windows. Turns out the permissions to the SQL Service Account on the folder is not enough and one has to set permissions from Disk Management also (selecting Properties on the Volume in Disk Management and then granting permissions to the SQL Service Account).
I use the code below to set permissions on a folder. Is there an equivalent PowerShell way to set permissions on the Volume/Disk? As one can do in the GUI in Disk Management.
$NewAcl = Get-Acl -Path "E:\Data\LUN"
# Set properties
$identity = "Domain\user"
$fileSystemRights = "FullControl"
$type = "Allow"
# Create new rule
$fileSystemAccessRuleArgumentList = $identity, $fileSystemRights, $type
$fileSystemAccessRule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $fileSystemAccessRuleArgumentList
# Apply new rule
$NewAcl.SetAccessRule($fileSystemAccessRule);
Set-Acl -Path "E:\Data\LUN" -AclObject $NewAcl;
Performing that ACL change at the Disk Management GUI is the same as applying the change to the root of the drive, with the object and container inheritance flags enabled. This is very verbose, but effectively this: