$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> 替换为适合环境的值。
resourceGroupName="<resource-group>"
storageAccountName="<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 $resourceGroupName \
--account-name $storageAccountName \
--query "${query}")
# Replace returned values if null with default values
protocolSettings="${protocolSettings/$replaceSmbMultichannel/$defaultSmbMultichannelEnabled}"
# Print returned settings
echo $protocolSettings
若要启用/禁用 SMB 多通道,请使用 az storage account file-service-properties update 命令。
若要获取 SMB 安全设置的状态,请使用 az storage account file-service-properties show 命令。 在运行这些 Bash 命令前,请记得将 <resource-group> 和 <storage-account> 替换为适合环境的值。
resourceGroupName="<resource-group>"
storageAccountName="<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 following
# PowerShell commands replace null values with the human-readable default values.
# 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 $resourceGroupName \
--account-name $storageAccountName \
--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