Purpose:
The purpose of this post is to walk through the experience of configuring a Windows client to map a drive to an Azure File Share, with the User Experience that they are used to. The process is documented in a multi-part article on Microsoft Docs. This post is meant to summarize the experience of going through this process and offer some guidance on areas that may be confusing. The steps to complete this task along with notes on the experience will be listed below.
Assumptions:
Knowledge of creating Azure Storage Accounts, Azure File Shares, and Synchronizing on-premise Active Directory user accounts to Azure AD with Azure AD Connect is assumed. It is also assumed that you have inserted data into the Azure File Share with a supported tool, like Azure File Sync, AzCopy, Windows Explorer, etc. Depending on the security posture needed for a production environment, this configuration would likely have tighter access controls. For our demonstration purposes, this configuration is being used for functionality and convenience.
Steps:
Run "Join-AzStorageAccountForAuth" cmdlet to join Storage account to Azure AD as shown here:
$ResourceGroupName = "My-Resource-Group-Name"
$StorageAccountName = "My-Sub-Name"
$Domain = "My-FQDN"
Import-Module -Name AzFilesHybrid
Join-AzStorageAccountForAuth `
-ResourceGroupName $ResourceGroupName `
-StorageAccountName $StorageAccountName `
-DomainAccountType "ComputerAccount" # Default is set as ComputerAccount `
-Domain $Domain
Note: These accounts cannot be privileged accounts in Active Directory because Azure AD Connect will not sync those accounts to Azure AD.
Note: If you omit this process, your AD users will NOT be able to access the Azure File Share as intended
Connect-AzAccount -Environment "AzureCloud" #Adjust as-necessary
$ResourceGroupName = "My-Resource-Group-Name"
$StorageAccountName = "My-Sub-Name"
Ipmo AzFilesBybrid
Update-AzStorageAccountADObjectPassword `
-RotateToKerbKey kerb2 `
-ResourceGroupName $ResourceGroupName `
-StorageAccountName $StorageAccountName
Note: There are three built-in Azure SMB Roles that can be used to control access at the Azure File Share Level. These are share-level permissions; NTFS permissions do NOT control access at the Azure File Share level.
$StorageAccountName = "My-Sub-Name"
$AzureFileShare = "My-Share-Name"
$connectTestResult = Test-NetConnection -ComputerName "$StorageAccountName.file.core.windows.net" -Port 445
if ($connectTestResult.TcpTestSucceeded)
{
net use X: "\\$StorageAccountName.file.core.windows.net\$AzureFileShare" /user:Azure\<StorageAcctName> '<StorageAccessKey>'
}
else
{
Write-Error -Message "Unable to reach the Azure storage account via port 445. Check to make sure your organization or ISP is not blocking port 445, or use Azure P2S VPN, Azure S2S VPN, or Express Route to tunnel SMB traffic over a different port."
}
Note: It is not recommended to keep the drive mapped with the Storage Account Key.
net use X: /DELETE
Connect-AzAccount -Environment "AzureCloud" #Adjust as-necessary
$ResourceGroupName = "My-Resource-Group-Name"
$StorageAccountName = "My-Sub-Name"
Ipmo AzFilesBybrid
Debug-AzStorageAccountAuth -StorageAccountName $StorageAccountName -ResourceGroupName $ResourceGroupName -Verbose
References:
Overview - On-premises AD DS authentication to Azure file shares | Microsoft Docs
Enable AD DS authentication to Azure file shares | Microsoft Docs
Control access to Azure file shares - on-premises AD DS authentication | Microsoft Docs
Control what a user can do at the file level - Azure file shares | Microsoft Docs
Mount Azure file share to an AD DS-joined VM | Microsoft Docs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.