How to use Object Storage in Azure Cloud
An Azure storage account is used to store data objects such as blobs, files, queues, tables, and disks. Data stored in the Storage Account is accessible from anywhere in the world over HTTP or HTTPS and is durable and highly available, it provides a unique namespace for your Azure Storage data. The following are the types of storage accounts.
- General-purpose v2 accounts: Basic storage account type for blobs, files, queues, and tables.
- General-purpose v1 accounts: Legacy account type for blobs, files, queues, and tables.
- BlockBlobStorage accounts: Storage accounts with premium performance characteristics for block blobs.
- FileStorage accounts: Files-only storage accounts with premium performance characteristics.
- BlobStorage accounts: Legacy Blob-only storage accounts.
For Azure Storage Account we need to pay only for what you use, there are no upfront fees. To know about its pricing, click here.
In this article, we will see the steps to create a Storage Account and create a container in it, and upload blobs in that container.
Here the word “blob” in Azure refers to unstructured object data and Azure Blob storage is a service for storing large amounts of unstructured object data.
Pre-requisites
- Azure Account (Create if you don’t have one).
What will we do?
- Login to Azure.
- Create a Storage Account.
Login to Azure
Click here to go Azure portal and click on Portal.
Use your credentials to log in to the account.
You will see the main page as follows once you successfully login to your account. Click on 3 lines near “Microsoft Azure” in the upper left-hand corner of the Azure portal to show the portal menu.
Create a Storage Account
Click on “All Services” in the left panel.
In the left panel, click on Storage and then click on “Storage Accounts”.
On the main dashboard on “Storage Account”, click on the “Add” button.
Create a New resource group if you don’t have any in your account and name it as test-rg. Given name to the storage account to be created, This name should be globally unique and no two storage accounts in Azure or can have the same name. Select a location where you want to create your storage account, select the “Account Kind” you want to create. Click on “Next: Networking”.
Specify the connectivity method to the storage account, here we have selected the public endpoint.
Click on “Next: Advanced”.
Click on “Next: Tags” to proceed with the default configuration under the “Advanced” tab.
Specify a tag as “environment: test”. You can specify multiple key:values as tags.
Click on “Review + create”.
Now, if you see the message “Validation passed” click on Create.
In some time, the storage account will be ready.
Click in the Resource group “test-rg” to go to the resource group in which the Storage Account is created.
Here, click on the Storage Account we just created.
On the overview page, you will see the details about the storage account.
In the left panel, click on Containers under “Blob Service”.
Click on “+ Container” to create a new container, give it a name, select the access level and click on “Create”.
Now you have a container inside the Storage Account in which you are now ready to upload your files/blobs.
Click in the Container we just created.
Here, you can now see the option “Upload”.
Click on “Upload”, select the file you want to upload and click on Upload.
Now, if you check the details of the file/blob you just uploaded, under Overview, you can see that the object has a URL field.
This link will be used to access the file/blob.
If you try to access the file using the link in the browser, you will not get “ResourceNotFound” error.
To fix the access issue, click on “Generate SAS” tab and then click on “Generate SAS token and URL”
Now you will get a “Blob SAS token” and “Blob SAS URL”
You can access the object from the browser using “Blob SAS URL”.
Hit the “Blob SAS URL” in the browser and you will now see your object.
Here, we had uploaded an image that can now be seen in the browser.
Conclusion
In this article, we saw how to create a Storage Account. We tried to upload an image and access it from the browser. We saw how to fix the permissions to access the image in the browser.