如何创建高级 Azure 文件共享How to create an premium Azure file share

高级文件共享在固态磁盘 (SSD) 存储介质上提供,可用于 IO 密集型工作负荷,包括宿主数据库和高性能计算 (HPC)。Premium file shares are offered on solid-state disk (SSD) storage media and are useful for IO-intensive workloads, including hosting databases and high-performance computing (HPC). 高级文件共享托管在特殊用途的存储帐户类型(称为 FileStorage 帐户)中。Premium file shares are hosted in a special purpose storage account kind, called a FileStorage account. 高级文件共享旨在用于高性能和企业级应用程序,可稳定提供低延迟、高 IOPS 和高吞吐量的共享。Premium file shares are designed for high performance and enterprise scale applications, providing consistent low latency, high IOPS, and high throughput shares.

本文介绍如何使用 Azure 门户、Azure PowerShell 和 Azure CLI 创建此新帐户类型。This article shows you how to create this new account type using Azure portal, Azure PowerShell, and Azure CLI.

先决条件Prerequisites

若要访问包含高级 Azure 文件共享的 Azure 资源,需要一个 Azure 订阅。To access Azure resources including premium Azure file shares, you'll need an Azure subscription. 如果还没有订阅,则在开始前创建一个 1 元人民币的试用帐户If you don't already have a subscription, then create a 1rmb trial account before you begin.

使用 Azure 门户创建高级文件共享Create a premium file share using the Azure portal

登录 AzureSign in to Azure

登录到 Azure 门户Sign in to the Azure portal.

创建 filestorage 存储帐户Create a filestorage storage account

现在可以创建存储帐户。Now you're ready to create your storage account.

每个存储帐户都必须属于 Azure 资源组。Every storage account must belong to an Azure resource group. 资源组是对 Azure 资源进行分组的逻辑容器。A resource group is a logical container for grouping your Azure services. 在创建存储帐户时,可以选择创建新的资源组,也可以使用现有资源组。When you create a storage account, you have the option to either create a new resource group, or use an existing resource group. 本文介绍如何创建新资源组。This article shows how to create a new resource group.

  1. 在 Azure 门户中,选择左侧菜单中的“存储帐户”。In the Azure portal, select Storage Accounts on the left menu.

    Azure 门户主页 - 选择存储帐户

  2. 在显示的“存储帐户”窗口中,选择“添加”。 On the Storage Accounts window that appears, choose Add.

  3. 选择要在其中创建存储帐户的订阅。Select the subscription in which to create the storage account.

  4. 在“资源组”字段下,选择“新建”。Under the Resource group field, select Create new. 输入新资源组的名称,如下图中所示。Enter a name for your new resource group, as shown in the following image.

  5. 然后,输入存储帐户的名称。Next, enter a name for your storage account. 所选名称在 Azure 中必须唯一。The name you choose must be unique across Azure. 该名称还必须为 3 到 24 个字符,并且只能包含数字和小写字母。The name also must be between 3 and 24 characters in length, and can include numbers and lowercase letters only.

  6. 选择存储帐户的位置或使用默认位置。Select a location for your storage account, or use the default location.

  7. 对于“性能”,请选择“高级”。 For Performance select Premium.

    必须选择“高级”,“FileStorage”才会成为“帐户类型”下拉列表中的可用选项。You must select Premium for FileStorage to be an available option in the Account kind dropdown.

  8. 依次选择“帐户类型”、“FileStorage”。 Select Account kind and choose FileStorage.

  9. 将“复制”保留设置为默认值“本地冗余存储(LRS)”。 Leave Replication set to its default value of Locally-redundant storage (LRS).

    如何创建高级文件共享的存储帐户

  10. 选择“查看+创建”可查看存储帐户设置并创建帐户。Select Review + Create to review your storage account settings and create the account.

  11. 选择“创建” 。Select Create.

创建存储帐户资源后,请导航到该资源。Once your storage account resource has been created, navigate to it.

创建高级文件共享Create a premium file share

  1. 在存储帐户的左侧菜单中滚动到“文件服务”部分,然后选择“文件”。 In the left menu for the storage account, scroll to the File service section, then select Files.
  2. 选择“文件共享”以创建高级文件共享。Select File share to create a premium file share.
  3. 输入文件共享的名称和所需配额,然后选择“创建”。Enter a name and a desired quota for your file share, then select Create.

备注

预配的共享大小按共享配额指定,文件共享按预配大小计费。有关更多详细信息,请参阅定价页Provisioned share sizes is specified by the share quota, file shares are billed on the provisioned size, refer to the pricing page for more details.

创建高级文件共享

清理资源Clean up resources

若要清理本文创建的资源,可以直接删除资源组。If you would like to clean up the resources created in this article, you can simply delete the resource group. 删除资源组也会删除相关联的存储帐户,以及与资源组相关联的任何其他资源。Deleting the resource group also deletes the associated storage account as well as any other resources associated with the resource group.

使用 PowerShell 创建高级文件共享Create a premium file share using PowerShell

使用 PowerShell 创建帐户Create an account using PowerShell

首先,安装最新版本的 PowerShellGet 模块。First, install the latest version of the PowerShellGet module.

然后,升级 PowerShell 模块,登录到 Azure 订阅,创建资源组,然后创建存储帐户。Then, upgrade your PowerShell module, sign in to your Azure subscription, create a resource group, and then create a storage account.

升级 PowerShell 模块Upgrade your PowerShell module

若要在 PowerShell 中与高级文件共享交互,需要安装 Az.Storage 模块版本1.4.0,或最新的 Az.Storage 模块。To interact with a premium file share from with PowerShell, you'll need to install an Az.Storage module version 1.4.0, or the latest Az.Storage module.

首先使用提升的权限打开 PowerShell 会话。Start by opening a PowerShell session with elevated permissions.

安装 Az.Storage 模块:Install the Az.Storage module:

Install-Module Az.Storage -Repository PSGallery -AllowClobber -Force

登录到 Azure 订阅Sign in to your Azure Subscription

使用 Connect-AzAccount 命令并按照屏幕上的说明进行身份验证。Use the Connect-AzAccount command and follow the on-screen directions to authenticate.

Connect-AzAccount -Environment AzureChinaCloud

创建资源组Create a resource group

若要通过 PowerShell 创建新的资源组,请使用 New-AzResourceGroup 命令:To create a new resource group with PowerShell, use the New-AzResourceGroup command:

# put resource group in a variable so you can use the same group name going forward,
# without hardcoding it repeatedly
$resourceGroup = "storage-how-to-resource-group"
$location = "chinaeast2"
New-AzResourceGroup -Name $resourceGroup -Location $location

创建 FileStorage 存储帐户Create a FileStorage storage account

若要通过 PowerShell 创建 FileStorage 存储帐户,请使用 New-AzStorageAccount 命令:To create a FileStorage storage account from PowerShell, use the New-AzStorageAccount command:

$storageAcct = New-AzStorageAccount -ResourceGroupName $resourceGroup -Name "fileshowto" -SkuName "Premium_LRS" -Location "chinaeast2" -Kind "FileStorage"

创建高级文件共享Create a premium file share

创建 FileStorage 帐户后,接下来可以创建高级文件共享。Now that you have a FileStorage account, you can create a premium file share. 可使用 New-AzStorageShare cmdlet 来创建。Use the New-AzStorageShare cmdlet to create one.

备注

预配的共享大小按共享配额指定,文件共享按预配大小计费。有关更多详细信息,请参阅定价页Provisioned share sizes is specified by the share quota, file shares are billed on the provisioned size, refer to the pricing page for more details.

New-AzStorageShare `
   -Name myshare `
   -Context $storageAcct.Context

清理资源Clean up resources

若要删除资源组及其关联的资源(包括新的存储帐户),请使用 Remove-AzResourceGroup 命令:To remove the resource group and its associated resources, including the new storage account, use the Remove-AzResourceGroup command:

Remove-AzResourceGroup -Name $resourceGroup

使用 Azure CLI 创建高级文件共享Create a premium file share using Azure CLI

登录到 CLI 的本地安装,首先确保安装了最新版本,然后运行 login 命令:Log into your local installation of the CLI, first make sure you have the latest version, then run the login command:

az login

创建资源组Create a resource group

若要通过 Azure CLI 创建新的资源组,请使用 az group create 命令。To create a new resource group with Azure CLI, use the az group create command.

az group create `
    --name files-howto-resource-group `
    --location chinaeast2

创建 FileStorage 存储帐户Create a FileStorage storage account

若要通过 Azure CLI 创建 FileStorage 存储帐户,请使用 az storage account create 命令。To create a FileStorage storage account from the Azure CLI, use the az storage account create command.

az storage account create `
    --name fileshowto `
    --resource-group files-howto-resource-group `
    --location chinaeast2 `
    --sku Premium_LRS `
    --kind FileStorage

获取存储帐户密钥Get the storage account key

存储帐户密钥控制对存储帐户中的资源的访问,本文使用密钥来创建高级文件共享。Storage account keys control access to resources in a storage account, in this article, we use the key in order to create a premium file share. 这些密钥是在创建存储帐户时自动创建的。The keys are automatically created when you create a storage account. 可以使用 az storage account keys list 命令获取存储帐户的存储帐户密钥:You can get the storage account keys for your storage account by using the az storage account keys list command:

STORAGEKEY=$(az storage account keys list \
    --resource-group "myResourceGroup" \
    --account-name $STORAGEACCT \
    --query "[0].value" | tr -d '"')

创建高级文件共享Create a premium file share

创建 filestorage 帐户后,接下来可以创建高级文件共享。Now that you have a filestorage account, you can create a premium file share. 可使用 az storage share create 命令来创建。Use the az storage share create command to create one.

备注

预配的共享大小按共享配额指定,文件共享按预配大小计费。有关更多详细信息,请参阅定价页Provisioned share sizes is specified by the share quota, file shares are billed on the provisioned size, refer to the pricing page for more details.

az storage share create \
    --account-name $STORAGEACCT \
    --account-key $STORAGEKEY \
    --name "myshare" 

清理资源Clean up resources

若要删除资源组及其关联的资源(包括新的存储帐户),请使用 az group delete 命令。To remove the resource group and its associated resources, including the new storage account, use the az group delete command.

az group delete --name myResourceGroup

后续步骤Next steps

在本文中,你已创建一个高级文件共享。In this article, you've created a premium file share. 若要了解此帐户提供的性能,请转到规划指南的“性能层”部分。To learn about the performance this account offers, continue to the performance tier section of the planning guide.