Azure File Share Auth with OnPremise AD (AzureFilesHybrid)
做了一個LAB之中有一些經驗分享
1.如果想要用AzureFileShare 但是只想要讓使用者存取裡面的特定資料夾
需要啟用ACL
驗證方式可以選擇地端AD 雲端AD
這邊說明 選擇地端AD的做法
參考文件
https://robertsmit.wordpress.com/2020/05/11/step-by-step-azure-files-share-smb-with-native-ad-support-and-more-microsoft-azurefiles-smb-snapshotmanagement-azure-cloud-mvpbuzz-wimvp/
官方的教學
https://learn.microsoft.com/zh-tw/azure/storage/files/storage-files-identity-ad-ds-enable?WT.mc_id=Portal-Microsoft_Azure_FileStorage
前置作業
1.下載指令檔案到你的DC上
https://github.com/Azure-Samples/azure-files-samples/releases
2.地端準備一台在已加入網域至內部部署 AD DS 的裝置上安裝並執行模組,該認證具有在目標 AD (中建立服務登入帳戶或電腦帳戶的許可權,例如網域系統管理員) 。建議環境是windows Server 2016含以上 會比較順利
3.AZURE已作AAD Connect與網域驗證
以下是我的Powershell 執行在地端DC上
注意 每個人的訂閱ID與租戶ID 資源名稱都會不同
請換成自己的
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
.\CopyToPSPath.ps1
Import-Module -Name AzFilesHybrid
$SubscriptionId = "03780720-4637-42fa-90d2-eb9c48001c42"
$ResourceGroupName = "INTUNEDEMO"
$StorageAccountName = "wdqdqwdqwdq"
Connect-AzAccount -TenantId bdeb748c-1588-492c-b5e9-366bb144fa07 //有MFA的帳號要用這種方式登入 如果沒有MFA用 Connect-AzAccount 即可
Get-AzSubscription
Select-AzSubscription -SubscriptionId $SubscriptionId
Join-AzStorageAccount -ResourceGroupName $ResourceGroupName -Name $StorageAccountName -DomainAccountType "ComputerAccount" -OrganizationalUnitName "FileServers"
# Get the target storage account
$storageaccount = Get-AzStorageAccount `
-ResourceGroupName $ResourceGroupName `
-Name $StorageAccountName
# List the directory service of the selected service account
$storageAccount.AzureFilesIdentityBasedAuth.DirectoryServiceOptions
# List the directory domain information if the storage account has enabled
#AD DS authentication for file shares
$storageAccount.AzureFilesIdentityBasedAuth.ActiveDirectoryProperties
成功後回AZURE看你的儲存帳戶 就會看到驗證方式已變成AD
先用sharekey去掛載這個空間
然後在安全性上面開始指派帳號 (如同操作地端SMB磁碟的方式)
之後就能改用mount with AD的方式來掛載此磁碟
footer See also :
留言