您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

快速入门:使用 Azure 门户上传、下载和列出 BlobQuickstart: Upload, download, and list blobs with the Azure portal

本快速入门介绍如何使用 Azure 门户在 Azure 存储中创建容器,以及在该容器中上传和下载块 Blob。In this quickstart, you learn how to use the Azure portal to create a container in Azure Storage, and to upload and download block blobs in that container.

先决条件Prerequisites

若要访问 Azure 存储,需要一个 Azure 订阅。To access Azure Storage, you'll need an Azure subscription. 如果还没有订阅,则请在开始前创建一个免费帐户If you don't already have a subscription, then create a free 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 the account, see Create a storage account.

创建容器Create a container

若要在 Azure 门户中创建容器,请执行以下步骤:To create a container in the Azure portal, follow these steps:

  1. 导航到 Azure 门户中的新存储帐户。Navigate to your new storage account in the Azure portal.

  2. 在存储帐户的左侧菜单中滚动到“Blob 服务”部分,然后选择“Blob”。In the left menu for the storage account, scroll to the Blob service section, then select Blobs.

  3. 选择“+ 容器”。Select the + Container button.

  4. 键入新容器的名称。Type a name for your new container. 容器名称必须小写,必须以字母或数字开头,并且只能包含字母、数字和短划线 (-) 字符。The container name must be lowercase, must start with a letter or number, and can include only letters, numbers, and the dash (-) character. 有关容器名称和 Blob 名称的详细信息,请参阅 Naming and referencing containers, blobs, and metadata(命名和引用容器、Blob 和元数据)。For more information about container and blob names, see Naming and referencing containers, blobs, and metadata.

  5. 设置容器的公共访问权限级别。Set the level of public access to the container. 默认级别为“专用(禁止匿名访问)”。The default level is Private (no anonymous access).

  6. 选择“确定”创建容器。Select OK to create the container.

    显示如何在 Azure 门户中创建容器的屏幕截图

上传块 BlobUpload a block blob

块 Blob 包含经过组装后可以生成 Blob 的数据块。Block blobs consist of blocks of data assembled to make a blob. 大多数使用 Blob 存储的方案都采用块 Blob。Most scenarios using Blob storage employ block blobs. 块 Blob 适用于在云中存储文本和二进制数据,例如文件、图像和视频。Block blobs are ideal for storing text and binary data in the cloud, like files, images, and videos. 本快速入门介绍如何使用块 Blob。This quickstart shows how to work with block blobs.

若要在 Azure 门户中将块 Blob 上传到新的容器,请执行以下步骤:To upload a block blob to your new container in the Azure portal, follow these steps:

  1. 在 Azure 门户中,导航到在上一部分创建的容器。In the Azure portal, navigate to the container you created in the previous section.

  2. 选择一个容器,显示其包含的 Blob 的列表。Select the container to show a list of blobs it contains. 此容器为新容器,因此不会包含任何 Blob。Since this container is new, it won't yet contain any blobs.

  3. 选择“上传”按钮将 Blob 上传到容器。Select the Upload button to upload a blob to the container.

  4. 浏览本地文件系统,找到一个可作为块 Blob 上传的文件,然后选择“上传”。Browse your local file system to find a file to upload as a block blob, and select Upload.

    显示如何将 Blob 从本地驱动器上传的屏幕截图

  5. 选择“身份验证类型”。Select the Authentication type. 默认值为 SASThe default is SAS.

  6. 以这种方式根据需要上传相应数量的 Blob。Upload as many blobs as you like in this way. 可以看到新的 Blob 现已列在容器中。You'll see that the new blobs are now listed within the container.

下载块 BlobDownload a block blob

可以下载一个块 Blob,让其在浏览器中显示,或者将其保存到本地文件系统。You can download a block blob to display in the browser or save to your local file system. 若要下载块 Blob,请执行以下步骤:To download a block blob, follow these steps:

  1. 导航到在前一部分上传的 Blob 的列表。Navigate to the list of blobs that you uploaded in the previous section.
  2. 右键单击要下载的 Blob,然后选择“下载”。Right-click the blob you want to download, and select Download.

清理资源Clean up resources

若要删除在本快速入门中创建的资源,可以删除容器。To remove the resources you created in this quickstart, you can delete the container. 容器中的所有 Blob 也会被删除。All blobs in the container will also be deleted.

若要删除容器,请执行以下操作:To delete the container:

  1. 在 Azure 门户中,导航到存储帐户中的容器的列表。In the Azure portal, navigate to the list of containers in your storage account.
  2. 选择要删除的容器。Select the container to delete.
  3. 选择“更多”按钮 (...),然后选择“删除”。Select the More button (...), and select Delete.
  4. 确认要删除该容器。Confirm that you want to delete the container.

后续步骤Next steps

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