快速入门:使用 Azure 存储资源管理器创建 blobQuickstart: Use Azure Storage Explorer to create a blob

本快速入门介绍如何使用 Azure 存储资源管理器创建容器和 blob。In this quickstart, you learn how to use Azure Storage Explorer to create a container and a blob. 接下来,将了解如何将 blob 下载到本地计算机,以及如何在容器中查看所有 blob。Next, you learn how to download the blob to your local computer, and how to view all of the blobs in a container. 此外,还将了解如何创建 blob 快照、管理容器访问策略以及创建共享访问签名。You also learn how to create a snapshot of a blob, manage container access policies, and create a shared access signature.

先决条件Prerequisites

若要访问 Azure 存储,需要一个 Azure 订阅。To access Azure Storage, you'll need an Azure subscription. 如果还没有订阅,请在开始前创建一个 1 元试用帐户If you don't already have a subscription, create a 1rmb trial account before you begin.

对 Azure 存储进行的所有访问都要通过存储帐户完成。All access to Azure Storage takes place through a storage account. 对于本快速入门,请使用 Azure 门户、Azure PowerShell 或 Azure CLI 创建存储帐户。For this quickstart, create a storage account using the Azure portal, Azure PowerShell, or Azure CLI. 有关如何创建存储帐户的帮助,请参阅创建存储帐户For help creating a storage account, see Create a storage account.

本快速入门要求安装 Azure 存储资源管理器。This quickstart requires that you install Azure Storage Explorer. 若要安装适用于 Windows、Macintosh 或 Linux 的 Azure 存储资源管理器,请参阅 Azure 存储资源管理器To install Azure Storage Explorer for Windows, Macintosh, or Linux, see Azure Storage Explorer.

登录到存储资源管理器Log in to Storage Explorer

首次启动时,会显示“Microsoft Azure 存储资源管理器 - 连接”窗口。On first launch, the Microsoft Azure Storage Explorer - Connect window is shown. 存储资源管理器提供了多种连接到存储帐户的方式。Storage Explorer provides several ways to connect to storage accounts. 下表列出了不同的连接方式:The following table lists the different ways you can connect:

任务Task 目的Purpose
添加 Azure 帐户Add an Azure Account 将你重定向到组织的登录页,向 Azure 进行身份验证。Redirects you to your organization's sign-in page to authenticate you to Azure.
使用连接字符串或共享访问签名 URIUse a connection string or shared access signature URI 可以用来通过 SAS 令牌或共享的连接字符串直接访问容器或存储帐户。Can be used to directly access a container or storage account with a SAS token or a shared connection string.
使用存储帐户名称和密钥Use a storage account name and key 使用存储帐户的名称和密钥连接到 Azure 存储。Use the storage account name and key of your storage account to connect to Azure storage.

选择“添加 Azure 帐户” ,然后单击“登录...” 。按照屏幕提示操作,登录到 Azure 帐户。Select Add an Azure Account and click Sign in... Follow the on-screen prompts to sign into your Azure account.

Microsoft Azure 存储资源管理器 -“连接”窗口

完成连接以后,Azure 存储资源管理器会进行加载并显示“资源管理器”选项卡。When it completes connecting, Azure Storage Explorer loads with the Explorer tab shown. 以下视图可以查看通过 Azure 存储模拟器Cosmos DB 帐户或 Azure Stack 环境配置的所有 Azure 存储帐户和本地存储。This view gives you insight to all of your Azure storage accounts as well as local storage configured through the Azurite storage emulator, Cosmos DB accounts, or Azure Stack environments.

Microsoft Azure 存储资源管理器 -“连接”窗口

创建容器Create a container

始终将 Blob 上传到容器中。Blobs are always uploaded into a container. 这样,就能够整理 blob 组,就像在计算机的文件夹中整理文件一样。This allows you to organize groups of blobs like you organize your files on your computer in folders.

若要创建容器,请展开在前面的步骤中创建的存储帐户。To create a container, expand the storage account you created in the proceeding step. 选择“Blob 容器”,然后右键单击并选择“创建 Blob 容器”。Select Blob Containers, right-click and select Create Blob Container. 输入 Blob 容器的名称。Enter the name for your blob container. 有关命名 blob 容器的规则和限制的列表,请参阅创建容器部分。See the Create a container section for a list of rules and restrictions on naming blob containers. 完成后,按 Enter 创建 Blob 容器。When complete, press Enter to create the blob container. 成功创建 Blob 容器后,该容器会显示在所选存储帐户的“Blob 容器”文件夹下。Once the blob container has been successfully created, it is displayed under the Blob Containers folder for the selected storage account.

将 blob 上传到容器Upload blobs to the container

Blob 存储支持块 blob、追加 blob 和页 blob。Blob storage supports block blobs, append blobs, and page blobs. 用于备份 IaaS VM 的 VHD 文件是页 Blob。VHD files used to back IaaS VMs are page blobs. 追加 blob 用于日志记录,例如有时需要写入到文件,再继续添加更多信息。Append blobs are used for logging, such as when you want to write to a file and then keep adding more information. Blob 存储中存储的大多数文件都是块 blob。Most files stored in Blob storage are block blobs.

在容器功能区中,选择“上传” 。On the container ribbon, select Upload. 此操作提供上传文件夹或文件的选项。This operation gives you the option to upload a folder or a file.

选择要上传的文件或文件夹。Choose the files or folder to upload. 选择“Blob 类型” 。Select the blob type. 可以接受的选项是“追加”、“页”或“块”Blob。Acceptable choices are Append, Page, or Block blob.

如果上传 .vhd 或 .vhdx 文件,请选择“将 .vhd/.vhdx 文件作为页 Blob 上传(推荐)”。If uploading a .vhd or .vhdx file, choose Upload .vhd/.vhdx files as page blobs (recommended).

在“上传到文件夹(可选)”字段中输入一个文件夹名称,用于在容器下的文件夹中存储文件或文件夹。In the Upload to folder (optional) field either a folder name to store the files or folders in a folder under the container. 如果没有选择任何文件夹,文件会直接上传到容器下。If no folder is chosen, the files are uploaded directly under the container.

Microsoft Azure 存储资源管理器 - 上传 Blob

选择“确定”以后,所选文件会排队上传。每个文件都会上传。When you select OK, the files selected are queued to upload, each file is uploaded. 上传完成后,结果显示在“活动”窗口中。When the upload is complete, the results are shown in the Activities window.

查看容器中的 BlobView blobs in a container

Azure 存储资源管理器应用程序的存储帐户下选择一个容器。In the Azure Storage Explorer application, select a container under a storage account. 主窗格会显示一个列表,包含所选容器中的 Blob。The main pane shows a list of the blobs in the selected container.

Microsoft Azure 存储资源管理器 - 列出容器中的 Blob

下载 BlobDownload blobs

若要使用 Azure 存储资源管理器下载 Blob,请在选中某个 Blob 的情况下,从功能区选择“下载”。To download blobs using Azure Storage Explorer, with a blob selected, select Download from the ribbon. 此时会打开一个文件对话框,用于输入文件名。A file dialog opens and provides you the ability to enter a file name. 选择“保存”,开始将 Blob 下载到本地位置。Select Save to start the download of a blob to the local location.

管理快照Manage snapshots

Azure 存储资源管理器提供拍摄和管理 Blob 快照的功能。Azure Storage Explorer provides the capability to take and manage snapshots of your blobs. 若要拍摄 Blob 的快照,请右键单击 Blob,然后选择“创建快照”。To take a snapshot of a blob, right-click the blob and select Create Snapshot. 若要查看 Blob 的快照,请右键单击 Blob,然后选择“管理快照”。To view snapshots for a blob, right-click the blob and select Manage Snapshots. 此时会在当前选项卡中显示 Blob 的快照列表。A list of the snapshots for the blob are shown in the current tab.

Microsoft Azure 存储资源管理器 - 列出容器中的 Blob

管理访问策略Manage access policies

存储资源管理器提供在其用户界面中管理容器的访问策略的功能。Storage Explorer provides the ability to manage access policies for containers within its user interface. 有两种类型的安全访问策略 (SAS),分别为服务级别的和帐户级别的。There are two types of secure access policies (SAS), service level and account level. 帐户级别 SAS 针对存储帐户,适用于多个服务和资源。Account level SAS targets the storage account and can apply to multiple services and resources. 服务级别 SAS 基于特定服务下的资源而定义。Service level SAS are defined on a resource under a particular service. 若要生成服务级别 SAS,请右键单击任意容器,然后选择“管理访问策略...”。 若要生成帐户级别 SAS,请右键单击存储帐户。To generate a service level SAS, right-click any container and select Manage Access Policies.... To generate an account level SAS, right-click on the storage account.

选择“添加”添加新的访问策略,然后定义该策略的权限。Select Add to add a new access policy and define the permissions for the policy. 完成后选择“保存” ,保存此访问策略。When complete select Save to save the access policy. 此策略现在可以用于配置共享访问签名。This policy is now available for use when configuring a Shared Access Signature.

使用共享访问签名Work with Shared Access Signatures

共享访问签名 (SAS) 可以通过存储资源管理器进行检索。Shared Access Signatures (SAS) can be retrieved through Storage Explorer. 右键单击存储帐户、容器或 Blob,然后选择“获取共享访问签名...”。 选择 SAS URL 的开始时间和过期时间以及权限,然后选择“创建”。Right-click a storage account, container, or blob and choose Get Shared Access Signature.... Choose the start and expiry time, and permissions for the SAS URL and select Create. 包含查询字符串的完整 URL 以及查询字符串本身都已提供,可以从下一屏幕复制。The full URL with the query string as well as the query string by itself are provided and can be copied from the next screen.

Microsoft Azure 存储资源管理器 - 列出容器中的 Blob

后续步骤Next steps

本快速入门介绍了如何使用 Azure 存储资源管理器在本地磁盘和 Azure Blob 存储之间转移文件。In this quickstart, you learned how to transfer files between a local disk and Azure Blob storage using Azure Storage Explorer. 要深入了解如何使用 Blob 存储,请继续学习 Blob 存储操作说明。To learn more about working with Blob storage, continue to the Blob storage How-to.