$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 多重通道的狀態,請使用 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。
支援 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 命令:
$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)
}
}
}
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