将存储资源管理器与 Azure 文件存储配合使用Using Storage Explorer with Azure File storage

Azure 文件存储是一种使用标准服务器消息块 (SMB) 协议在云中提供文件共享的服务。Azure File storage is a service that offers file shares in the cloud using the standard Server Message Block (SMB) Protocol. 支持 SMB 2.1 和 SMB 3.0。Both SMB 2.1 and SMB 3.0 are supported. 通过 Azure 文件存储,可以将依赖文件共享的旧版应用程序快速迁移到 Azure 且无成本高昂的重写。With Azure File storage, you can migrate legacy applications that rely on file shares to Azure quickly and without costly rewrites. 可以使用文件存储向外公开数据,或者私下存储应用程序数据。You can use File storage to expose data publicly to the world, or to store application data privately. 本文介绍如何使用存储资源管理器处理文件共享和文件。In this article, you'll learn how to use Storage Explorer to work with file shares and files.

先决条件Prerequisites

若要完成本文中的步骤,需要满足以下先决条件:To complete the steps in this article, you'll need the following:

创建文件共享Create a File Share

所有文件都必须驻留在文件共享中。文件共享就是对文件进行逻辑分组。All files must reside in a file share, which is simply a logical grouping of files. 一个帐户可以包含无限数量的文件共享,一个共享可以存储无限数量的文件。An account can contain an unlimited number of file shares, and each share can store an unlimited number of files.

以下步骤演示了如何在存储资源管理器中创建文件共享。The following steps illustrate how to create a file share within Storage Explorer.

  1. 打开存储资源管理器。Open Storage Explorer.

  2. 在左窗格中,展开需要在其中创建文件共享的存储帐户。In the left pane, expand the storage account within which you wish to create the File Share

  3. 右键单击“文件共享”,并从上下文菜单中选择“创建文件共享”。Right-click File Shares, and - from the context menu - select Create File Share.

    创建文件共享

  4. 此时会在“文件共享”文件夹下显示一个文本框。A text box will appear below the File Shares folder. 输入文件共享的名称。Enter the name for your file share. 如需文件共享命名规则和限制的列表,请参阅共享命名规则部分。See the Share naming rules section for a list of rules and restrictions on naming file shares.

    共享命名

  5. 可以在完成时按 Enter 创建文件共享,也可以按 Esc 取消。Press Enter when done to create the file share, or Esc to cancel. 成功创建文件共享后,该共享会显示在所选存储帐户的“文件共享”文件夹下。Once the file share has been successfully created, it will be displayed under the File Shares folder for the selected storage account.

    新建共享

查看文件共享的内容View a file share's contents

文件共享包含文件和文件夹(文件夹中也可能包含文件)。File shares contain files and folders (that can also contain files).

以下步骤演示了如何在存储资源管理器中查看文件共享的内容:The following steps illustrate how to view the contents of a file share within Storage Explorer:+

  1. 打开存储资源管理器。Open Storage Explorer.

  2. 在左窗格中,展开其中包含要查看的文件共享的存储帐户。In the left pane, expand the storage account containing the file share you wish to view.

  3. 展开该存储帐户的“文件共享”。Expand the storage account's File Shares.

  4. 右键单击要查看的文件共享,并从上下文菜单中选择“打开”。Right-click the file share you wish to view, and - from the context menu - select Open. 也可双击要查看的文件共享。You can also double-click the file share you wish to view.

    打开共享

  5. 主窗格会显示该文件共享的内容。The main pane will display the file share's contents.

    共享的内容

删除文件共享Delete a file share

可以根据需要轻松地创建和删除文件共享。File shares can be easily created and deleted as needed. (若要了解如何删除各个文件,请参阅管理文件共享中的文件部分。)(To see how to delete individual files, refer to the section, Managing files in a file share.)

以下步骤演示了如何在存储资源管理器中删除文件共享:The following steps illustrate how to delete a file share within Storage Explorer:

  1. 打开存储资源管理器。Open Storage Explorer.

  2. 在左窗格中,展开其中包含要查看的文件共享的存储帐户。In the left pane, expand the storage account containing the file share you wish to view.

  3. 展开该存储帐户的“文件共享”。Expand the storage account's File Shares.

  4. 右键单击要删除的文件共享,并从上下文菜单中选择“删除”。Right-click the file share you wish to delete, and - from the context menu - select Delete. 也可通过按“删除”来删除当前选定的文件共享。You can also press Delete to delete the currently selected file share.

    删除

  5. 出现确认对话框时,选择“是”。Select Yes to the confirmation dialog.

    确认对话框

复制文件共享Copy a file share

可以通过存储资源管理器将文件共享复制到剪贴板,然后再将该文件共享粘贴到另一存储帐户中。Storage Explorer enables you to copy a file share to the clipboard, and then paste that file share into another storage account. (若要了解如何复制各个文件,请参阅管理文件共享中的文件部分。)(To see how to copy individual files, refer to the section, Managing files in a file share.)

以下步骤演示了如何将文件共享从一个存储帐户复制到另一个存储帐户。The following steps illustrate how to copy a file share from one storage account to another.

  1. 打开存储资源管理器。Open Storage Explorer.

  2. 在左窗格中,展开其中包含要复制的文件共享的存储帐户。In the left pane, expand the storage account containing the file share you wish to copy.

  3. 展开该存储帐户的“文件共享”。Expand the storage account's File Shares.

  4. 右键单击要复制的文件共享,并从上下文菜单中选择“复制文件共享”。Right-click the file share you wish to copy, and - from the context menu - select Copy File Share.

    复制文件共享

  5. 右键单击要将文件共享粘贴到其中的“目标”存储帐户,并从上下文菜单中选择“粘贴文件共享”。Right-click the desired "target" storage account into which you want to paste the file share, and - from the context menu - select Paste File Share.

    粘贴文件共享

获取文件共享的 SASGet the SAS for a file share

共享访问签名 (SAS) 用于对存储帐户中的资源进行委托访问。A shared access signature (SAS) provides delegated access to resources in your storage account. 这意味着可以授权客户端在指定时间段内,以一组指定权限有限地访问存储帐户中的对象,而不必共享帐户访问密钥。This means that you can grant a client limited permissions to objects in your storage account for a specified period of time and with a specified set of permissions, without having to share your account access keys.

以下步骤演示了如何为文件共享创建 SAS:The following steps illustrate how to create a SAS for a file share:+

  1. 打开存储资源管理器。Open Storage Explorer.

  2. 在左窗格中,展开要获取其 SAS 的文件共享所在的存储帐户。In the left pane, expand the storage account containing the file share for which you wish to get a SAS.

  3. 展开该存储帐户的“文件共享”。Expand the storage account's File Shares.

  4. 右键单击所需文件共享,并从上下文菜单中选择“获取共享访问签名”。Right-click the desired file share, and - from the context menu - select Get Shared Access Signature.

    获取共享访问签名

  5. 在“共享访问签名”对话框中,根据需要为资源指定策略、开始和过期日期、时区以及访问级别。In the Shared Access Signature dialog, specify the policy, start and expiration dates, time zone, and access levels you want for the resource.

    SAS 对话框

  6. 指定完 SAS 选项以后,选择“创建”。When you're finished specifying the SAS options, select Create.

  7. 然后会显示第二个“共享访问签名”对话框,其中列出了可用来访问存储资源的文件共享以及 URL 和 QueryString。A second Shared Access Signature dialog will then display that lists the file share along with the URL and QueryStrings you can use to access the storage resource. 选择要复制到剪贴板的 URL 旁边的“复制”。Select Copy next to the URL you wish to copy to the clipboard.

    第二个 SAS 对话框

  8. 完成后,选择“关闭”。When done, select Close.

管理文件共享的访问策略Manage Access Policies for a file share

以下步骤演示了如何管理(添加和删除)文件共享的访问策略。The following steps illustrate how to manage (add and remove) access policies for a file share:+ . 访问策略用于创建 SAS URL,用户可以通过该 URL 在定义的时段访问存储文件资源。The Access Policies is used for creating SAS URLs through which people can use to access the Storage File resource during a defined period of time.

  1. 打开存储资源管理器。Open Storage Explorer.

  2. 在左窗格中,展开要管理其访问策略的文件共享所在的存储帐户。In the left pane, expand the storage account containing the file share whose access policies you wish to manage.

  3. 展开该存储帐户的“文件共享”。Expand the storage account's File Shares.

  4. 选择所需文件共享,并从上下文菜单中选择“管理访问策略”。Select the desired file share, and - from the context menu - select Manage Access Policies.

    “管理访问策略”上下文菜单

  5. “访问策略”对话框列出为所选文件共享创建的任何访问策略。The Access Policies dialog will list any access policies already created for the selected file share.

    访问策略

  6. 根据访问策略管理任务完成以下步骤:Follow these steps depending on the access policy management task:

    • 添加新的访问策略 - 选择“添加”。Add a new access policy - Select Add. 生成后,“访问策略”对话框会显示新添加的访问策略(以及默认设置)。Once generated, the Access Policies dialog will display the newly added access policy (with default settings).

    • 编辑访问策略 - 进行需要的编辑,并选择“保存”。Edit an access policy - Make any desired edits, and select Save.

    • 删除访问策略 - 在要删除的访问策略旁边选择“删除”。Remove an access policy - Select Remove next to the access policy you wish to remove.

  7. 使用以前创建的访问策略创建新的 SAS URL:Create a new SAS URL using the Access Policy you created earlier:

    获取 SAS

    SAS 名称和属性

管理文件共享中的文件Managing files in a file share

创建文件共享以后,即可将文件上传到该文件共享、将文件下载到本地计算机、在本地计算机上打开文件,等等。Once you've created a file share, you can upload a file to that file share, download a file to your local computer, open a file on your local computer, and much more.

以下步骤演示如何管理文件共享中的文件(和文件夹)。The following steps illustrate how to manage the files (and folders) within a file share.

  1. 打开存储资源管理器。Open Storage Explorer.

  2. 在左窗格中,展开其中包含要管理的文件共享的存储帐户。In the left pane, expand the storage account containing the file share you wish to manage.

  3. 展开该存储帐户的“文件共享”。Expand the storage account's File Shares.

  4. 双击要查看的文件共享。Double-click the file share you wish to view.

  5. 主窗格会显示该文件共享的内容。The main pane will display the file share's contents.

    共享的内容

  6. 主窗格会显示该文件共享的内容。The main pane will display the file share's contents.

  7. 根据所要执行的任务完成以下步骤:Follow these steps depending on the task you wish to perform:

    • 将文件上传到文件共享Upload files to a file share

      a.a. 在主窗格的工具栏上选择“上载”,并从下拉菜单中选择“上载文件”。On the main pane's toolbar, select Upload, and then Upload Files from the drop-down menu.

      上传文件

      b.b. 在“上传文件”对话框中,选择“文件”文本框右侧的省略号 (…) 按钮,以选择要上传的文件。In the Upload files dialog, select the ellipsis () button on the right side of the Files text box to select the file(s) you wish to upload.

      添加文件

      c.c. 选择“上传”。Select Upload.

    • 将文件夹上传到文件共享Upload a folder to a file share

      a.a. 在主窗格的工具栏上选择“上传”,并从下拉菜单中选择“上传文件夹”。On the main pane's toolbar, select Upload, and then Upload Folder from the drop-down menu.

      “上传文件夹”菜单

      b.b. 在“上传文件夹”对话框中,选择“文件夹”文本框右侧的省略号 (…) 按钮,以选择要上传其内容的文件夹。In the Upload folder dialog, select the ellipsis () button on the right side of the Folder text box to select the folder whose contents you wish to upload.

      c.c. (可选)指定要将选定文件夹的内容上传到其中的目标文件夹。Optionally, specify a target folder into which the selected folder's contents will be uploaded. 如果目标文件夹不存在,系统会创建一个。If the target folder doesn’t exist, it will be created.

      d.d. 选择“上传”。Select Upload.

    • 将文件下载到本地计算机Download a file to your local computer

      a.a. 选择要下载的文件。Select the file you wish to download.

      b.b. 在主窗格的工具栏上,选择“下载”。On the main pane's toolbar, select Download.

      c.c. 在“指定已下载文件的保存位置”对话框中,指定要将文件下载到其中的位置,以及要为文件提供的名称。In the Specify where to save the downloaded file dialog, specify the location where you want the file downloaded, and the name you wish to give it.

      d.d. 选择“其他安全性验证” 。Select Save.

    • 在本地计算机上打开文件Open a file on your local computer

      a.a. 选择要打开的文件。Select the file you wish to open.

      b.b. 在主窗格的工具栏上,选择“打开”。On the main pane's toolbar, select Open.

      c.c. 会使用与文件的基础文件类型相关联的应用程序下载和打开文件。The file will be downloaded and opened using the application associated with the file's underlying file type.

    • 将文件复制到剪贴板Copy a file to the clipboard

      a.a. 选择要复制的文件。Select the file you wish to copy.

      b.b. 在主窗格的工具栏上,选择“复制”。On the main pane's toolbar, select Copy.

      c.c. 在左窗格中导航到另一文件共享,并通过双击在主窗格中查看它。In the left pane, navigate to another file share, and double-click it to view it in the main pane.

      d.d. 在主窗格的工具栏上选择“粘贴”,创建文件的副本。On the main pane's toolbar, select Paste to create a copy of the file.

    • 删除文件Delete a file

      a.a. 选择要删除的文件。Select the file you wish to delete.

      b.b. 在主窗格的工具栏上,选择“删除”。On the main pane's toolbar, select Delete.

      c.c. 出现确认对话框时,选择“是”。Select Yes to the confirmation dialog.

后续步骤Next steps