Topics Map > Infrastructure > Cloud Computing > Azure
What is Azure Blob Storage and how do I use it?
Azure Blob storage is Microsoft's object storage solution for the cloud. Blob storage is optimized for storing massive amounts of unstructured data. Unstructured data is data that does not adhere to a particular data model or definition, such as text or binary data.
Blob storage is designed for:
- Serving images or documents directly to a browser.
- Storing files for distributed access.
- Streaming video and audio.
- Writing to log files.
- Storing data for backup and restore, disaster recovery, and archiving.
- Storing data for analysis by an on-premises or Azure-hosted service.
Users or client applications can access objects in Blob storage via HTTP/HTTPS, from anywhere in the world. Objects in Blob storage are accessible via the Azure Storage REST API, Azure PowerShell, Azure CLI, or an Azure Storage client library. Client libraries are available for a variety of languages, including .NET, Java, Node.js, Python, Go, PHP, and Ruby.
Azure Storage supports three types of blobs:
- Block blobs store text and binary data, up to about 4.7 TB. Block blobs are made up of blocks of data that can be managed individually.
- Append blobs are made up of blocks like block blobs, but are optimized for append operations. Append blobs are ideal for scenarios such as logging data from virtual machines.
- Page blobs store random access files up to 8 TB in size. Page blobs store virtual hard drive (VHD) files and serve as disks for Azure virtual machines.
Create a container
To create a container in the Azure portal, follow these steps:
- Click on Storage Accounts on the blade on the left-hand side.
- Navigate to your new storage account in the Azure portal that was created when we created our virtual machine. In the previous example, I called it “testrgsa2”.
- In the left menu for the storage account, scroll to the Blob service section, then select Blobs.
- Select the + Container
- 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. Set the level of public access to the container. The default level is Private (no anonymous access).
- Select OK to create the container.
Upload a block blob
Block blobs consist of blocks of data assembled to make a blob. Most scenarios using Blob storage employ block blobs. Block blobs are ideal for storing text and binary data in the cloud, like files, images, and videos. This quickstart shows how to work with block blobs.
To upload a block blob to your new container in the Azure portal, follow these steps:
- In the Azure portal, navigate to the container you created in the previous section.
- Select the container to show a list of blobs it contains. Since this container is new, it won't yet contain any blobs.
- Select the Upload button to upload a blob to the container.
- Browse your local file system to find a file to upload as a block blob, and select Upload.
- Select the Authentication type. The default is SAS.
- Upload as many blobs as you like in this way. You'll see that the new blobs are now listed within the container.
Download a block blob
You can download a block blob to display in the browser or save to your local file system. To download a block blob, follow these steps:
- Navigate to the list of blobs that you uploaded in the previous section.
- Right-click the blob you want to download and select Download.
NOTE: To view the contents of a blob via URL, click on the Blob and then click on the “Generate SAS” tab. Click on “Generate blob SAS token and URL” at the bottom of the screen and copy and paste the URL into your browser of choice. The default settings make this URL valid for 8 hours, grant read only access, and allow it to be accessed from any IP.