11-04-2020 02:58 PM - edited 11-04-2020 06:49 PM
In the last 3 weeks, I have been getting a lot of questions around Azure Files. The main question has been “Can computer accounts have access Azure Files?”. This combined with my work on MSIX app attach (which also uses Azure Files) has prompted the creation of this post.
Azure Files supports multiple authentication mechanisms. This article is focused on authenticating with
AD DS, as described here. Hence the prerequisites are:
1. Create AD DS security group.
2. Add the computer accounts for all session hosts as members of the group
3. Synch AD DS group to Azure AD
4. Create storage account
5. Create file share under the storage account
6. Join storage account to AD DS
7. Assign the AD DS group that has been synched to Azure AD, the Storage File Data SMB Share Contributor role assignment on the storage account
8. Mount file share on any session host
9. Grant NTFS permissions on the file share to the AD DS group
This group will be used in later steps to grant share level and (files share) permissions.
Note: it is not mandatory to create a new group, an existing group can be used.
Note: If this is a new group it may take up to 1 hour to sync with Azure AD.
For brevity we will assume there is already a storage account with a file share. If required, please reference this article on how to create storage accounts. If you’re creating a new storage account, it is mandatory to create a file share.
Note: if you are creating a Premium storage account make sure Account Kind is set to FileStorage.
In this step we are going to join our storage account to AD DS. The full article is available here. Please note our steps here have been modified to achieve the desired scenario.
Note: Run the script using an on-premises AD DS credential that is synced to your Azure AD. The on-premises AD DS credential must have either the storage account owner or the contributor Azure role permissions.
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
$SubscriptionId = "<your-subscription-id-here>"
$ResourceGroupName = "<resource-group-name-here>"
$StorageAccountName = "<storage-account-name-here>"
Join-AzStorageAccountForAuth `
-ResourceGroupName $ResourceGroupName `
-StorageAccountName $StorageAccountName `
-DomainAccountType "ComputerAccount" `
-OrganizationalUnitDistinguishedName "<ou-here>" `
-EncryptionType "'RC4','AES256'"
To be able to authenticate with AD DS computer accounts against an Azure Files storage account, we must also assign NTFS level permission in addition to the RBAC permission we set up earlier.
net use <desired-drive-letter>: \\<storage-account-name>.file.core.windows.net\<share-name> /user:Azure\<storage-account-name> <storage-account-key>
Note: Make sure that the output of the command above is “The command completed successfully”.
If not, repeat and verify input.
Note: Make sure that domain name matches your AD DS domain name, if it doesn’t the storage account has not been domain joined.
Common challenges with granting machine accounts access to Azure Files share authenticated with Azure AD are captured in the sections below.
When a VM is added to an AD DS group that VM needs to be restarted in order to pick up its membership to the group.
The Azure Files team have excellent troubleshooting document available here. There are few errors that I have observed occurring with higher frequency:
The synch interval between AD DS and Azure AD is 30 minutes by default. If the AD DS group was create in the last 30 minutes and cannot be assigned to the storage account, option 1 is to wait, option 2 is to force the AD DS -> Azure AD sync. Sample script, here.
For MSIX app attach and FSLogix the minimum RBAC permissions on the storage account are Storage File Data SMB Share Contributor.
For MSIX app attach and FSLogix the minimum NTFS permissions on the storage account are Read & Execute, and List folder content.
11-05-2020 08:15 AM
Great article @Stefan Georgiev
Anyone interested in seeing a video walking through this process check out The Azure Academy
video on Azure Files with AD Authentication
https://www.youtube.com/watch?v=9S5A1IJqfOQ
11-05-2020 08:17 AM