We can configure Windows access control lists (ACLs), also known as NTFS permissions, at the root, directory, or file level on directory and file level over mounted file share(s). While share-level permissions act as a high-level gatekeeper that determines whether a user can access the share, Windows ACLs operate at a more granular level to control what operations the user can do at the directory or file level.
Both share-level and file/directory-level permissions are enforced when a user attempts to access a file/directory, so if there’s a difference between either of them, only the most restrictive one will be applied. For example, if a user has read/write access at the file level, but only read at a share level, then they can only read that file. The same would be true if it was reversed: if a user had read/write access at the share-level, but only read at the file-level, they can still only read the file.
There are multiple ways we can apply NTFS permission during your data migration by using other tools such as azcopy or robocopy. Here are some related posts from this blog:
- Using AzCopy to Migrate Local Files to Azure blob Storage with SMB Permission
- Use RobCop (RoboCopy) to Migrate Files with NTFS Permission
Table of Contents
Azure Share-Level Permission Mapping to NTFS Permission
The following table contains the Azure RBAC permissions related to this configuration. If you’re using Azure Storage Explorer, you’ll also need the Reader and Data Access role in order to read/access the file share.
Table for NTFS Permission (RBAC) + SMB Roles:
|Share-level permission (built-in role)||NTFS permission||Resulting access|
|Storage File Data SMB Share Reader||Full control, Modify, Read, Write, Execute||Read & execute|
|Storage File Data SMB Share Contributor||Full control||Modify, Read, Write, Execute|
|Read & execute||Read & execute|
|Storage File Data SMB Share Elevated Contributor||Full control||Modify, Read, Write, Edit (Change permissions), Execute|
|Read & execute||Read & execute|
Permission Mtrix for RBAC with SMB Roles (Reader, Contributor, Elevated Contributor):
Supported Windows ACLS (NTFS)
||Built-in security group representing administrators of the file server. This group is empty, and no one can be added to it.|
||Built-in security group representing users of the file server. It includes
||The service account of the operating system of the file server. Such service account doesn’t apply in Azure Files context. It is included in the root directory to be consistent with Windows Files Server experience for hybrid scenarios.|
||All users in AD that can get a valid Kerberos token.|
||Each object either directory or file has an owner for that object. If there are ACLs assigned to
The following permissions are included on the root directory of a file share:
NT AUTHORITY\Authenticated Users:(OI)(CI)(M)
Mount the file share using storage account key
Before you configure Windows ACLs, you must first mount the file share by using your storage account key. To do this, log into a domain-joined device, open a Windows command prompt, and run the following command. Remember to replace
<YourStorageAccountKey> with your own values. If Z: is already in use, replace it with an available drive letter. You can find your storage account key in the Azure portal by navigating to the storage account and selecting Security + networking > Access keys, or you can use the
Get-AzStorageAccountKey PowerShell cmdlet.
It’s important that you use the
net use Windows command to mount the share at this stage and not PowerShell. If you use PowerShell to mount the share, then the share won’t be visible to Windows File Explorer or cmd.exe, and you’ll have difficulty configuring Windows ACLs.
net use Z: \\<YourStorageAccountName>.file.core.windows.net\<FileShareName> /user:localhost\<YourStorageAccountName> <YourStorageAccountKey>
net use R: \\fileshare4test.file.core.windows.net\fstest /user:localhost\fileshare4test h1GUuy3YasaG1LLNjQLQ8wD9PpYtyeVY1MY6s4s11BJLJQTzyUaX69LzYsDVyYOKm3cXgrsvYOpX+AStkQD+zW==
- net use
Robocopy "F:\testshare" "R:\test" /COPY:DAT /SEC /MIR /R:10 /W:5 /V /ETA
./azcopy.exe copy "F:\testshare\" "https://fileshare4test.file.core.windows.net/fstest/testfolder/?sv=2021-06-08&ss=bfqt&srt=sco&sp=rwdlacupiytfx&se=2022-09-13T05:11:14Z&st=2022-09-12T21:11:14Z&spr=https&sig=85MdmVM%2FGwPmAQSay0sDC1mCboxZZP62UdFnYmW1HHR%3D" --preserve-smb-info=true --preserve-smb-permissions=true --disable-auto-decoding=false --recursive --log-level=INFO
Monunt File Shares
The key is to give a user full control first using storage account name and key to mount file shares.