Earn More by Sharing What You Love
Do you create content for developers working with .NET, C#, Java, Python, or Node.js? Turn your expertise into extra income!

Tim Corey
1h 05m 37s
Azure Storage is an essential service offered by Microsoft Azure, and when combined with .NET technologies, it becomes a powerful tool for storing and retrieving files in the cloud. In his in-depth tutorial "Intro to Azure Storage in C#," Tim Corey walks viewers through the exact steps of configuring an Azure Storage Account, setting up Azure Blob Storage, and integrating it into a C# ASP.NET Core MVC project.
In this article, we will follow Tim's video closely to explore every stage of the process, discussing key concepts and terminologies used in real-world Azure development.
Tim begins by explaining the financial efficiency of using Azure Storage in a C# application. Whether you're using a blob container to store text files, images, or binary data, the cost remains minimal. He introduces the Azure Pricing Calculator to estimate charges based on selected features like performance tiers, redundancy settings, and data operations.
Tim chooses Block Blob Storage under General-purpose v2 in the Azure portal and configures the hot access tier for frequently accessed files. He ensures that the storage account is using locally redundant storage (LRS) to minimize costs while still maintaining safety.
"For a demo app storing 1 GB of data and a few thousand operations, the cost comes down to 13 cents per month," Tim explains.
In the Azure portal, Tim demonstrates how to create a new resource group and a corresponding Azure Storage Account. Naming conventions are strict - storage account names must be unique, lowercase, and contain no dashes.
While setting up, he disables Geo-redundant storage to save on cost, a critical tip for developers working on prototypes or local environments. He also enables anonymous access at the container level, but only for demonstration purposes - warning that real production environments require secured access.

Tim also covers access keys, the connection string, and the storage account name - all essential when your C# project connects to Azure resources.
Tim highlights how a blob container is used to organize data in your Azure storage account. He avoids creating a new container manually via the portal and instead plans to generate it in code using the Azure SDK for .NET.
He explains that secure access keys and the connection string - viewable under the account's security settings - will be used in the application to authenticate with the storage client library.
Tim creates a .NET 9 MVC web application using Visual Studio. Although any UI type like Razor Pages or Blazor Server could be used, he selects MVC for demonstration.
At 19:35, in secrets.json, he stores sensitive credentials securely:

Tim explains that appsettings.json should not contain secrets, as it gets committed to source code repositories. Instead, secrets should be stored locally using User Secrets, especially during development.
To interact with Azure Blob Storage, Tim installs the Azure.Storage.Blobs NuGet package. He appreciates how Microsoft has modularized features using the Azure SDK, enabling smaller, more maintainable applications.

"Instead of bundling everything into the framework, now you get exactly what you need - like the Azure Blob client library - via NuGet," Tim points out.
Next, Tim creates a POCO class (BlobStorageOptions) to match the keys in his config. He uses the options pattern to bind configuration into strongly typed objects, enabling centralized and testable configuration.
This setup makes it easy for the .NET app to use the Azure configuration consistently across environments.
Tim adds a new folder called DataAccess and implements a class named BlobStorage.cs. Inside, he injects the configuration using IOptions<BlobStorageOptions> and stores it in a private instance.
He builds two primary async methods:
The UploadFileAsync method:
Tim uses a using statement and an await call to handle the file stream securely, preventing memory leaks.
In DownloadFileAsync, Tim:
This ensures files remain secure and are only accessible through the application - not directly through URL guessing.
Tim defines an interface (IBlobStorage) for his class and registers it as a Singleton in the .NET DI container. Since the class is stateless and uses only configuration values, Singleton is optimal.
The Home Controller is modified to use IBlobStorage. It contains:
Each method interacts with the storage client to securely handle blob files, whether uploading or downloading.
In Index.cshtml, Tim sets up:
Tim also handles errors using a List<string> to present them clearly on the UI, keeping users informed of issues like missing file selections.
Tim uploads a text file and tries accessing the URI directly in the browser - it fails, as expected, due to the None access policy.
After temporarily changing the access level in the Azure portal, the file becomes downloadable via direct link. But he promptly reverts it to Private, emphasizing how Azure provides fine-grained control over security.
Tim concludes by reminding developers that Microsoft Azure offers a lot of value even with minimal investment. With tools like:
you can quickly build a production-ready storage solution using C#. Whether you're working on a large-scale system or a small test project, Azure Blob Storage is a scalable and cost-effective choice.
"You pay for what you use in the cloud - so ask for only what you need," Tim emphasizes.
From creating a storage account and configuring blob containers, to securely handling uploads and downloads in an MVC application, Tim Corey provides detailed instructions that cover the entire lifecycle of using Azure Storage with .NET.
With this guide and Tim's video, you can start using Azure Blob Storage with confidence - while maintaining control, minimizing cost, and adhering to best practices in cloud development.
Do check out his complete video for further clarity and his YouTube Channel for more insightful content on Azure storage (C#).
Do you create content for developers working with .NET, C#, Java, Python, or Node.js? Turn your expertise into extra income!
Join our newsletter, you’ll get exclusive access on article updates. We value your privacy