fbpx
Hero Illustration
0 Comments
Azure, Mitrais, Software Development, Storage

Connect and Store Data in Azure Blob Storage

What is Azure Blob Storage?

Azure Blob Storage, provided by Microsoft, is a service for storing copious amounts of unstructured object data. It can be helpful in many use cases, such as serving images or documents directly to the browser, video and audio streaming, storing log files, etc.

Azure Blob is one of the offerings in the Azure group of data services alongside Azure Files, Azure Queues, and Azure Tables under the generic title of “Azure Storage.”

Users or clients’ applications can access objects in Blob storage via HTTP/HTTPS through the Azure Storage REST API, Azure PowerShell, Azure CLI, or an Azure Storage client library.

Azure offers three storage tiers to store data in Blob Storage:

  • Hot Access tier
  • Cool Access tier
  • Archive tier

Why Use Azure Blob Storage?

Azure Blob Storage is equivalent to Amazon’s S3 and has the advantage of supporting HTTPS.

It allows you to store files cost-effectively and automatically replicate them across several regions. By planning the use of the various storage tiers, you can choose the price/performance needed for your unique business requirements.

It has robust access controls to ensure that only the correct program/person accesses the files. Azure Blob Storage is the best choice to store files when the app runs in Azure. It also has some advantages over S3, like Shared Access Signatures, that make it easy to control access to files directly via a URL.

Shared Access Signatures can provide temporary access to a file, which is excellent compared to competitors like S3 since the access control is embedded in the URL rather than needing to use an AWS identity.

Advantages of Azure Blob Storage

  • Encryption of files and encryption of data at rest
  • You can manage encryption on your own 
  • Serving over HTTPS
  • Easy to backup Virtual Machines
  • Inbound transfers are free
  • It has relatively inexpensive storage, and if your data already exists in Azure, there are no ingress or egress fees
  • Cost-effective for storing large amounts of data when compared to other providers
  • Azure Storage Explorer makes drag and drops to copy files around/download them
  • Capable of long-term retention
  • Suitable for different data formats
  • Allows archival storage
  • Tiering – Hot/Cold/Archive allows you to pay for the performance you need for the task
  • Provide Azure Blob Storage REST API to support portability

Disadvantages of Azure Blob Storage

  • It could prove expensive for outbound data transfers, especially in an actual Disaster Recovery scenario, so make sure you fully cost your options before implementing
  • There are some limitations on Blob storage size. Ensure you check Blob limits if you are moving enormous data sets.
  • Documentation sometimes appears outdated or not fully documented, especially with new releases. As with many Microsoft products, documentation is scarce on new releases and only seems to get adequately updated (and sometimes incorrectly) once enough people hit the forums to complain.
  • Search for files can be slow

Typical Use Cases and Deployment Scope

  • Backing up Virtual Machines
  • Creation of data lakes for analytics
  • Storage of SQL Server backups and audit logs. Backup directly from your SQL Servers running on VMs to your Azure Blob Storage accounts. Set SQL Server Audits to write now to Azure Blob Storage.
  • A staging ground for storing spreadsheet files for forecasting models.
  • Use the cold and archive tiers as a cheap location to store long-term backups and archives. Think of it as a replacement for tape offloading in your Disaster Recovery strategy. Caveat: the cost to bring those backups/archives back from the cloud can be very high.
  • Storage for Business Intelligence reporting involves heavy lifting via some of the great PowerShell commands in Azure. It’s easy to use and can flag upload file sizes.
  • Due to the flexibility of the Security options, it can be an excellent way to share data with internal users and customers.
  • Use as a centralized location for storing customers’ documents alongside Dynamics 365 and for generating Power Business Intelligence Reports.

Getting Started

Once you work out your data strategy, Azure Blob Storage is relatively easy to set up. This post will show how to connect to Azure Blob Storage and store a file using a client library. In this case, we will use the local environment (Azurite emulator) and implement it in .NET Web API. In addition, we will use a package/library provided by Microsoft called Azure.Storage.Blobs in NuGet Package Manager.

Once you install the package, you will need to add the configuration. The primary things necessary are a connection string and a container name. It can be stored in a function or bound in an application setting.

In this case, we added it in appsettings.json as follows :

Remember to bind this setting in Program. Cs just like the following code:

The next step is creating a function to get a list of objects or upload a file into the storage. The code produced is like this:

In the constructor, set the Blob Container Client to refer to our configuration. In this case, the upload function is directly from this using the file’s path, but it can be changed by other methods like Stream/Memory Stream from a byte file or others.

Conclusion

If an organization is already using Azure Cloud or Microsoft Office products, using Azure Blob for all their storage need is a no-brainer considering its seamless integration with all the different Microsoft products. Due to the low-cost tiered options, those not into the Microsoft Azure platform should still compare it with Google, AWS, or any other Cloud Storage solutions.

It is well-suited as the storage layer for SaaS offerings within the Azure Service Catalog and has built-in integration. Furthermore, it is ideal as a backup storage target for long-term Recovery Point Objectives and offsite archival storage when the expectation of actual retrieval needs is very low. It is also a good option for emergency storage needs (burst storage) for an immediate need.

Another area of strength is the encryption of data at rest, and encryption can be managed on your own. Finally, Azure Blob Storage is cheaper than Google Cloud Storage and offers more regions and easy accessibility.

For the complete source code, you can check this link.

References

  1. Introduction to Blob (object) storage – Azure Storage | Microsoft Learn
  2. Create an Azure Storage account – Training | Microsoft Learn
  3. https://www.trustradius.com/products/azure-blob-storage/reviews

Author: Pandu Galuh Rahmantyo, Software Engineer – Programmer

Contact us to learn more!

Please complete the brief information below and we will follow up shortly.

    ** All fields are required
    Leave a comment