Hi Arman Koradia,
Welcome to Microsoft Q&A, thanks for posting your query.
Adding additional information for the above answer.
Yes, you can create an Azure File Share and mount it to both your VM and AVD hosting using the same drive letter across all systems.
Here are few steps to set it up:
Create the Azure File Share:
Navigate to your Azure Storage Account >> File Shares, create a new file share, and note the connection string.
Azure Files provides SMB-based file shares that are ideal for scenarios where multiple VMs need simultaneous read/write access to the same file system, without requiring clustering software.
Mount the File Share on Each Host/VM:
Use PowerShell to mount it consistently with a specific drive letter (e.g., Z:). Example PowerShell command:
net use Z: \\<StorageAccountName>.file.core.windows.net\<FileShareName> /u:<StorageAccountName> <StorageAccountKey>
Replace "<StorageAccountName>", "<FileShareName>", and "<StorageAccountKey>" with your details. Run this on each VM/AVD Host to ensure they use the same drive letter.
Issue-2:
Restricting Delete Permissions on folder:
To restrict delete permissions for all users except administrators, you can use PowerShell to set NTFS permissions on folders within the shared disks. This allows you to control access by denying delete permissions for the users and grants all the access permissions to administrator.
To adjust NTFS permissions use PowerShell:
Run the script on either the Azure VM or an AVD host where the shared disk is attached.
The script will remove delete permissions for all users, except the administrator group.
# Set the path to the folder where delete restriction is needed
$folderPath = "D:\SharedFolder" # Adjust path as necessary
# Get the current ACL (Access Control List) for the folder
$acl = Get-Acl -Path $folderPath
# Define a rule that denies delete permissions for all users
$denyRule = New-Object System.Security.AccessControl.FileSystemAccessRule(
"Users", # Adjust group as needed
"Delete",
"Deny"
)
# Add the deny rule to the ACL
$acl.SetAccessRule($denyRule)
# Define a rule that allows full control for administrators
$allowAdminRule = New-Object System.Security.AccessControl.FileSystemAccessRule(
"Administrators",
"FullControl",
"Allow"
)
# Add the allow rule for administrators to the ACL
$acl.SetAccessRule($allowAdminRule)
# Apply the updated ACL to the folder
Set-Acl -Path $folderPath -AclObject $acl
Write-Output "Permissions updated successfully on $folderPath"
This approach ensures that only administrators have the ability to delete folders on the shared disk, while standard users are restricted.
Run the Script as Administrator:
The PowerShell script should be run as an administrator to make sure that it has permissions to modify the ACL on the shared disk.
After running the script, verify that the users are still able to read and write to the disk but are unable to delete folders, while administrator has the full control.
Please feel free to contact if the issue persists, we will be glad to assist you closely. Please do consider clicking on "Accept Answer"
and "Up-vote"
on the post that helps you, as it can be beneficial to other community members.