Azure 檔案儲存體提供兩種業界標準通訊協定來裝載 Azure 檔案共用:伺服器訊息區 (SMB) 通訊協定和網路檔案系統 (NFS) 通訊協定。 Azure 檔案儲存體可讓您挑選最適合您工作負載的檔案系統通訊協定。 雖然您可以在相同的儲存體帳戶內建立 SMB 和 NFS 檔案共用,但 Azure 檔案共用不支援使用 SMB 和 NFS 通訊協定來存取個別的 Azure 檔案共用。 針對所有檔案共用,Azure 檔案儲存體提供企業級的檔案共用,可進行擴大以符合您的儲存需求,且可以由數千個用戶端同時存取。
本文涵蓋 SMB Azure 檔案共用。 如需 NFS Azure 檔案共用的詳細資訊,請參閱 NFS Azure 檔案共用。
適用對象
管理模型 |
計費模型 |
媒體分層 |
冗餘性 |
中小企業 (SMB) |
網路檔案系統 (NFS) |
Microsoft 儲存服務 |
已佈建的 v2 |
HDD (標準) |
本地 (LRS) |
|
|
Microsoft 儲存服務 |
已佈建的 v2 |
HDD (標準) |
區域 (ZRS) |
|
|
Microsoft 儲存服務 |
已佈建的 v2 |
HDD (標準) |
異地 (GRS) |
|
|
Microsoft 儲存服務 |
已佈建的 v2 |
HDD (標準) |
GeoZone (GZRS) |
|
|
Microsoft 儲存服務 |
已佈建的 v1 |
SSD (進階版) |
本地 (LRS) |
|
|
Microsoft 儲存服務 |
已佈建的 v1 |
SSD (進階版) |
區域 (ZRS) |
|
|
Microsoft 儲存服務 |
隨用隨付 |
HDD (標準) |
本地 (LRS) |
|
|
Microsoft 儲存服務 |
隨用隨付 |
HDD (標準) |
區域 (ZRS) |
|
|
Microsoft 儲存服務 |
隨用隨付 |
HDD (標準) |
異地 (GRS) |
|
|
Microsoft 儲存服務 |
隨用隨付 |
HDD (標準) |
GeoZone (GZRS) |
|
|
常見案例
SMB 檔案共用用於許多應用程式,包括供終端使用者使用的檔案共用,以及支援資料庫和應用程式的檔案共用。 SMB 檔案共用通常用於下列案例:
- 使用者檔案共用,例如小組共用、主目錄等。
- 適用於 Windows 應用程式的支援儲存體,例如 SQL Server 資料庫或針對 Win32 或 .NET 本機檔案系統 API 所撰寫的企業營運應用程式。
- 新的應用程式和服務開發,特別是當該應用程式或服務具有隨機 IO 和階層式儲存體的需求時。
功能
Azure 檔案儲存體支援 SMB 和 Azure 的主要功能,而這些功能是 SMB 檔案共用中生產部署所需的功能:
- AD 網域加入和判別存取控制清單 (DACL)。
- 整合無伺服器備份與 Azure 備份。
- 使用 Azure 私人端點的網路隔離。
- 使用 SMB 多重通道來提高網路吞吐量(僅限 SSD 檔案共用)。
- SMB 通道加密,包括 AES-256-GCM、AES-128-GCM 和 AES-128-CCM。
- 透過 VSS 整合共用快照集的舊版支援。
- Azure 檔案共用上以防止意外刪除的自動虛刪除。
- 選擇性網際網路可存取的檔案共用,具有網際網路安全的 SMB 3.0+。
SMB 檔案共用可以直接裝載於內部部署環境,也可以使用 Azure 檔案同步在內部部署環境中進行快取。
安全性
使用 Azure 儲存體服務加密 (SSE) 將儲存在 Azure 檔案儲存體中的所有資料進行待用加密。 儲存體服務加密的運作方式與 Windows 上的 BitLocker 相似:資料會在檔案系統層級下加密。 由於資料是在 Azure 檔案共用的檔案系統下加密,因此當其編碼為磁碟時,不需要存取用戶端上的基礎金鑰,即可讀取或寫入 Azure 檔案共用。 待用加密同時適用於 SMB 和 NFS 通訊協定。
根據預設,所有 Azure 檔案共用都已啟用傳輸中的加密,因此只允許使用 SMB 3.x 進行加密的 SMB 掛接。 如果啟用傳輸中的加密,則會拒絕來自不支援SMB通道加密的SMB 3.x協定用戶端的掛載。
搭配 Windows Server 2022 或 Windows 11 使用時,Azure 檔案儲存體支援使用 SMB 3.1.1 的 AES-256-GCM。 SMB 3.1.1 也支援 AES-128-GCM,而 SMB 3.0 支援 AES-128-CCM。 基於效能考量,依預設會在 Windows 10 21H1 版上交涉 AES-128-GCM。
您可以停用 Azure 檔案共享傳輸中的加密。 停用加密時,Azure 檔案服務允許 SMB 2.1 和 SMB 3.x 不加密。 會停用傳輸中加密的主要原因,是為了支援必須在舊版作業系統上執行的繼承應用程式,例如 Windows Server 2008 R2 或舊版 Linux 散發套件。 Azure 檔案服務只允許與 Azure 檔案共用位於相同 Azure 區域內的 SMB 2.1 連線;Azure 檔案共用 Azure 區域以外的 SMB 2.1 用戶端,例如內部部署或不同 Azure 區域中,無法存取檔案共用。
SMB 通訊協定設定
Azure 檔案儲存體提供了多項設定,這些設定會影響 SMB 通訊協定的行為、效能和安全性。 這些設定適用於儲存體帳戶內的所有 Azure 檔案共用。
SMB 多重通道
SMB 多重通道可讓 SMB 3.x 用戶端建立連至 SMB 檔案共用的多個網路連線。 Azure 檔案記憶體支援 SSD 檔案共用上的 SMB 多重通道。 SMB 多重通道現在預設會在所有 Azure 區域中啟用。
若要檢視 SMB 多重通道的狀態,請流覽至包含 SSD 檔案共用的記憶體帳戶,然後在記憶體帳戶目錄的 [資料記憶體] 標題下選取 [檔案分享]。 您應該會在 [ 檔案共享設定 ] 區段底下看到SMB多重通道的狀態。 如果您沒有看到,請確定您的儲存帳戶是 FileStorage 帳戶種類。
若要啟用或停用 SMB 多重通道,請選取目前的狀態 (根據狀態選取 [啟用] 或 [停用])。 產生的對話方塊會提供切換來啟用或停用 SMB 多重通道。 選取想要的狀態,然後選取 [儲存]。
若要取得 SMB 多重通道的狀態,請使用 Get-AzStorageFileServiceProperty
Cmdlet。 執行這些 PowerShell 命令之前,請記得先將 <resource-group>
和 <storage-account>
取代為您環境的適當值。
$resourceGroupName = "<resource-group>"
$storageAccountName = "<storage-account>"
# Get reference to storage account
$storageAccount = Get-AzStorageAccount `
-ResourceGroupName $resourceGroupName `
-StorageAccountName $storageAccountName
# If you've never enabled or disabled SMB Multichannel, the value for the SMB Multichannel
# property returned by Azure Files will be null. Null returned values should be interpreted
# as "default settings are in effect". To make this more user-friendly, the following
# PowerShell commands replace null values with the human-readable default values.
$defaultSmbMultichannelEnabled = $false
# Get the current value for SMB Multichannel
Get-AzStorageFileServiceProperty -StorageAccount $storageAccount | `
Select-Object -Property `
ResourceGroupName, `
StorageAccountName, `
@{
Name = "SmbMultichannelEnabled";
Expression = {
if ($null -eq $_.ProtocolSettings.Smb.Multichannel.Enabled) {
$defaultSmbMultichannelEnabled
} else {
$_.ProtocolSettings.Smb.Multichannel.Enabled
}
}
}
若要啟用/停用 SMB 多重通道,請使用 Update-AzStorageFileServiceProperty
Cmdlet。
Update-AzStorageFileServiceProperty `
-StorageAccount $storageAccount `
-EnableSmbMultichannel $true
若要取得 SMB 多重通道的狀態,請使用 az storage account file-service-properties show
命令。 執行這些 Bash 命令之前,請記得先將 <resource-group>
和 <storage-account>
取代為您環境的適當值。
RESOURCE_GROUP_NAME="<resource-group>"
STORAGE_ACCOUNT_NAME="<storage-account>"
# If you've never enabled or disabled SMB Multichannel, the value for the SMB Multichannel
# property returned by Azure Files will be null. Null returned values should be interpreted
# as "default settings are in effect". To make this more user-friendly, the following
# PowerShell commands replace null values with the human-readable default values.
## Search strings
REPLACESMBMULTICHANNEL="\"smbMultichannelEnabled\": null"
# Replacement values for null parameters.
DEFAULTSMBMULTICHANNELENABLED="\"smbMultichannelEnabled\": false"
# Build JMESPath query string
QUERY="{"
QUERY="${QUERY}smbMultichannelEnabled: protocolSettings.smb.multichannel.enabled"
QUERY="${QUERY}}"
# Get protocol settings from the Azure Files FileService object
protocolSettings=$(az storage account file-service-properties show \
--resource-group $RESOURCE_GROUP_NAME \
--account-name $STORAGE_ACCOUNT_NAME \
--query "${QUERY}")
# Replace returned values if null with default values
PROTOCOL_SETTINGS="${protocolSettings/$REPLACESMBMULTICHANNEL/$DEFAULTSMBMULTICHANNELENABLED}"
# Print returned settings
echo $PROTOCOL_SETTINGS
若要啟用/停用 SMB 多重通道,請使用 az storage account file-service-properties update
Cmdlet。
az storage account file-service-properties update \
--resource-group $RESOURCE_GROUP_NAME \
--account-name $STORAGE_ACCOUNT_NAME \
--enable-smb-multichannel "true"
在舊版操作系統上啟用SMB多重通道
支援 Azure 檔案儲存體中的 SMB 多重通道需要確保 Windows 已套用所有相關修補檔。 數個較舊的 Windows 版本 (包括 Windows Server 2016、Windows 10 1607 版和 Windows 10 1507 版) 需要針對所有相關的 SMB 多重通道修正程式設定額外的登錄機碼,以套用至完整修補的安裝。 如果您執行的 Windows 版本比這三個版本還新,則不需要進行其他動作。
Windows Server 2016 與 Windows 10 1607 版
若要啟用 Windows Server 2016 和 Windows 10 1607 版的所有 SMB 多重通道修正程式,請執行下列 PowerShell 命令:
Set-ItemProperty `
-Path "HKLM:SYSTEM\CurrentControlSet\Policies\Microsoft\FeatureManagement\Overrides" `
-Name "2291605642" `
-Value 1 `
-Force
Windows 10 版本 1507
若要啟用 Windows 10 1507 版的所有 SMB 多重通道修正程式,請執行下列 PowerShell 命令:
Set-ItemProperty `
-Path "HKLM:\SYSTEM\CurrentControlSet\Services\MRxSmb\KBSwitch" `
-Name "{FFC376AE-A5D2-47DC-A36F-FE9A46D53D75}" `
-Value 1 `
-Force
SMB 安全性設定
Azure 檔案儲存體公開設定可讓您根據組織的需求,將 SMB 通訊協定切換為更相容或更安全。 依預設,Azure 檔案儲存體會設定為最高相容,因此請記住,限制這些設定可能會導致某些用戶端無法連線。
Azure 檔案儲存體會公開下列設定:
-
SMB 版本:允許的 SMB 版本。 支援的通訊協定版本為 SMB 3.1.1、SMB 3.0 和 SMB 2.1。 依預設會允許所有 SMB 版本,不過,如果啟用「需要安全傳輸」,則不允許 SMB 2.1,因為 SMB 2.1 不支援傳輸中加密。
-
驗證方法:允許的 SMB 驗證方法。 支援的驗證方法為 NTLMv2 (僅儲存體帳戶金鑰) 和 Kerberos。 依預設允許所有驗證方法。 移除 NTLMv2 不允許使用儲存體帳戶金鑰來裝載 Azure 檔案共用。 Azure 檔案儲存體不支援針對網域認證使用 NTLM 驗證。
-
Kerberos 票證加密:允許的加密演算法。 支援的加密演算法是 AES-256 (建議) 和 RC4-HMAC。
-
SMB 通道加密:允許的 SMB 通道加密演算法。 支援的加密演算法為 AES-256-GCM、AES-128-GCM 和 AES-128-CCM。 如果您只選取 AES-256-GCM,您必須在每一個用戶端上以系統管理員身分開啟 PowerShell 終端機,並執行
Set-SmbClientConfiguration -EncryptionCiphers "AES_256_GCM" -Confirm:$false
,以告訴連線用戶端使用 AES-256-GCM。 Windows 11/Windows Server 2022 之前的 Windows 用戶端不支援使用 AES-256-GCM。
您可以使用 Azure 入口網站、PowerShell 或 CLI 來檢視和變更 SMB 安全性設定。 選取所需的索引標籤,以查看如何取得及設定 SMB 安全性設定的步驟。 請注意,這些設定會在建立 SMB 工作階段檢查,且在不符合時 SMB 工作階段設定會失敗,並出現錯誤「STATUS_ACCESS_DENIED」。
若要使用 Azure 入口網站來檢視或變更 SMB 安全性設定,請遵循下列步驟:
登入 Azure 入口網站並搜尋 記憶體帳戶。 選取您要檢視或變更SMB安全性設定的記憶體帳戶。
從服務功能表中,選取 [資料記憶體>檔案共用]。
在 [檔案共用設定] 底下,選取與 [安全性] 相關聯的值。 如果您尚未修改安全性設定,此值會預設為 [相容性上限]。
在 [設定檔] 底下,選取 [相容性上限]、[安全性上限] 或 [自訂]。 選取 [自訂] 可讓您為 SMB 通訊協定版本、SMB 通道加密、驗證機制和 Kerberos 票證加密建立自訂設定檔。
輸入所需的安全性設定後,請選取 [儲存]。
若要取得 SMB 通訊協定設定,請使用 Get-AzStorageFileServiceProperty
Cmdlet。 請記得將 <resource-group>
和 <storage-account>
取代為您環境適用的值。 如果您已刻意將任一 SMB 安全性設定設為 Null,例如停用 SMB 通道加密,請參閱指令碼中有關註解化特定行的指示。
$resourceGroupName = "<resource-group>"
$storageAccountName = "<storage-account>"
# Get reference to storage account
$storageAccount = Get-AzStorageAccount `
-ResourceGroupName $resourceGroupName `
-StorageAccountName $storageAccountName
# If you've never changed any SMB security settings, the values for the SMB security
# settings returned by Azure Files will be null. Null returned values should be interpreted
# as "default settings are in effect". To make this more user-friendly, the following
# PowerShell commands replace null values with the human-readable default values.
# If you've deliberately set any of your SMB security settings to null, for example by
# disabling SMB channel encryption, comment out the following four lines to avoid
# changing the security settings back to defaults.
$smbProtocolVersions = "SMB2.1", "SMB3.0", "SMB3.1.1"
$smbAuthenticationMethods = "NTLMv2", "Kerberos"
$smbKerberosTicketEncryption = "RC4-HMAC", "AES-256"
$smbChannelEncryption = "AES-128-CCM", "AES-128-GCM", "AES-256-GCM"
# Gets the current values of the SMB security settings
Get-AzStorageFileServiceProperty -StorageAccount $storageAccount | `
Select-Object -Property `
ResourceGroupName, `
StorageAccountName, `
@{
Name = "SmbProtocolVersions";
Expression = {
if ($null -eq $_.ProtocolSettings.Smb.Versions) {
[String]::Join(", ", $smbProtocolVersions)
} else {
[String]::Join(", ", $_.ProtocolSettings.Smb.Versions)
}
}
},
@{
Name = "SmbChannelEncryption";
Expression = {
if ($null -eq $_.ProtocolSettings.Smb.ChannelEncryption) {
[String]::Join(", ", $smbChannelEncryption)
} else {
[String]::Join(", ", $_.ProtocolSettings.Smb.ChannelEncryption)
}
}
},
@{
Name = "SmbAuthenticationMethods";
Expression = {
if ($null -eq $_.ProtocolSettings.Smb.AuthenticationMethods) {
[String]::Join(", ", $smbAuthenticationMethods)
} else {
[String]::Join(", ", $_.ProtocolSettings.Smb.AuthenticationMethods)
}
}
},
@{
Name = "SmbKerberosTicketEncryption";
Expression = {
if ($null -eq $_.ProtocolSettings.Smb.KerberosTicketEncryption) {
[String]::Join(", ", $smbKerberosTicketEncryption)
} else {
[String]::Join(", ", $_.ProtocolSettings.Smb.KerberosTicketEncryption)
}
}
}
取決於您組織的安全性、效能和相容性需求,您可能要修改 SMB 通訊協定設定。 下列 PowerShell 命令會將您的 SMB 檔案共用限制為僅限最安全的選項。
重要
將 SMB Azure 檔案共用限制為僅限最安全的選項時,可能會導致某些用戶端無法連線。 例如,從 Windows Server 2022 和 Windows 11 開始,導入 AES-256-GCM 作為 SMB 通道加密的選項。 這表示不支援 AES-256-GCM 的舊版用戶端將無法連線。 如果您只選取 AES-256-GCM,您必須在每一個用戶端上以系統管理員身分開啟 PowerShell 終端機,並執行 Set-SmbClientConfiguration -EncryptionCiphers "AES_256_GCM" -Confirm:$false
,以告訴 Windows 伺服器 2022 和 Windows 11 用戶端只能使用 AES-256-GCM。
Update-AzStorageFileServiceProperty `
-ResourceGroupName $resourceGroupName `
-StorageAccountName $storageAccountName `
-SmbAuthenticationMethod "Kerberos" `
-SmbChannelEncryption "AES-256-GCM" `
-SmbKerberosTicketEncryption "AES-256" `
-SmbProtocolVersion "SMB3.1.1"
若要取得 SMB 安全性設定的狀態,請使用 az storage account file-service-properties show
命令。 執行這些 Bash 命令之前,請記得先將 <resource-group>
和 <storage-account>
取代為您環境的適當值。 如果您已刻意將任一 SMB 安全性設定設為 Null,例如停用 SMB 通道加密,請參閱指令碼中有關註解化特定行的指示。
RESOURCE_GROUP_NAME="<resource-group>"
STORAGE_ACCOUNT_NAME="<storage-account>"
# If you've never changed any SMB security settings, the values for the SMB security
# settings returned by Azure Files will be null. Null returned values should be interpreted
# as "default settings are in effect". To make this more user-friendly, the commands in the
# following two sections replace null values with the human-readable default values.
# If you've deliberately set any of your SMB security settings to null, for example by
# disabling SMB channel encryption, comment out the following two sections before
# running the script to avoid changing the security settings back to defaults.
# Values to be replaced
REPLACESMBPROTOCOLVERSION="\"smbProtocolVersions\": null"
REPLACESMBCHANNELENCRYPTION="\"smbChannelEncryption\": null"
REPLACESMBAUTHENTICATIONMETHODS="\"smbAuthenticationMethods\": null"
REPLACESMBKERBEROSTICKETENCRYPTION="\"smbKerberosTicketEncryption\": null"
# Replacement values for null parameters. If you copy this into your own
# scripts, you will need to ensure that you keep these variables up-to-date with any new
# options we may add to these parameters in the future.
DEFAULTSMBPROTOCOLVERSIONS="\"smbProtocolVersions\": \"SMB2.1;SMB3.0;SMB3.1.1\""
DEFAULTSMBCHANNELENCRYPTION="\"smbChannelEncryption\": \"AES-128-CCM;AES-128-GCM;AES-256-GCM\""
DEFAULTSMBAUTHENTICATIONMETHODS="\"smbAuthenticationMethods\": \"NTLMv2;Kerberos\""
DEFAULTSMBKERBEROSTICKETENCRYPTION="\"smbKerberosTicketEncryption\": \"RC4-HMAC;AES-256\""
# Build JMESPath query string
QUERY="{"
QUERY="${QUERY}smbProtocolVersions: protocolSettings.smb.versions,"
QUERY="${QUERY}smbChannelEncryption: protocolSettings.smb.channelEncryption,"
QUERY="${QUERY}smbAuthenticationMethods: protocolSettings.smb.authenticationMethods,"
QUERY="${QUERY}smbKerberosTicketEncryption: protocolSettings.smb.kerberosTicketEncryption"
QUERY="${QUERY}}"
# Get protocol settings from the Azure Files FileService object
PROTOCOLSETTINGS=$(az storage account file-service-properties show \
--resource-group $RESOURCE_GROUP_NAME \
--account-name $STORAGE_ACCOUNT_NAME \
--query "${QUERY}")
# Replace returned values if null with default values
PROTOCOLSETTINGS="${protocolSettings/$REPLACESMBPROTOCOLVERSION/$DEFAULTSMBPROTOCOLVERSIONS}"
PROTOCOLSETTINGS="${protocolSettings/$REPLACESMBCHANNELENCRYPTION/$DEFAULTSMBCHANNELENCRYPTION}"
PROTOCOLSETTINGS="${protocolSettings/$REPLACESMBAUTHENTICATIONMETHODS/$DEFAULTSMBAUTHENTICATIONMETHODS}"
PROTOCOLSETTINGS="${protocolSettings/$REPLACESMBKERBEROSTICKETENCRYPTION/$DEFAULTSMBKERBEROSTICKETENCRYPTION}"
# Print returned settings
echo $PROTOCOLSETTINGS
取決於您組織的安全性、效能和相容性需求,您可能想要修改 SMB 通訊協定設定。 下列 Azure CLI 命令會將您的 SMB 檔案共用限制為僅限最安全的選項。
重要
將 SMB Azure 檔案共用限制為僅限最安全的選項時,可能會導致某些用戶端無法連線。 例如,從 Windows Server 2022 和 Windows 11 開始,導入 AES-256-GCM 作為 SMB 通道加密的選項。 這表示不支援 AES-256-GCM 的舊版用戶端將無法連線。 如果您只選取 AES-256-GCM,您必須在每一個用戶端上以系統管理員身分開啟 PowerShell 終端機,並執行 Set-SmbClientConfiguration -EncryptionCiphers "AES_256_GCM" -Confirm:$false
,以告訴 Windows 伺服器 2022 和 Windows 11 用戶端只能使用 AES-256-GCM。
az storage account file-service-properties update \
--resource-group $RESOURCE_GROUP_NAME \
--account-name $STORAGE_ACCOUNT_NAME \
--versions "SMB3.1.1" \
--channel-encryption "AES-256-GCM" \
--auth-methods "Kerberos" \
--kerb-ticket-encryption "AES-256"
限制
Azure 檔案儲存體中的 SMB 檔案共用支援 SMB 通訊協定和 NTFS 檔案系統支援的功能子集。 雖然大部分的使用案例和應用程式都不需要這些功能,但某些應用程式相依於不支援的功能時,可能無法正常地與 Azure 檔案儲存體搭配使用。 不支援下列功能:
區域可用性
SMB Azure 檔案共用可在每個 Azure 區域中使用,包括所有公用和主權區域。 SSD 檔案共用可在 區域的子集中使用。
下一步