This console application demonstrates practical Azure Blob Storage operations using the Azure.Storage.Blobs SDK for .NET. The examples cover generating Shared Access Signature (SAS) tokens with time-limited permissions, uploading blobs using SAS URIs, downloading blob content, and handling SAS token expiration scenarios.
The code creates a blob with a GUID-based name, generates separate write and read SAS tokens with different expiry windows, and then performs upload and download operations using those tokens. It also includes a scenario that tests what happens when a SAS token expires (using a 5-second read token), making it a useful reference for understanding Azure Blob Storage security patterns and SAS token lifecycle management.
- .NET 8.0 SDK or later
- NuGet package:
Azure.Storage.Blobsv12.22.0 - An Azure Storage account with a connection string
cd AzureBlobStorageExamples.ConsoleApp
dotnet runYou will need to configure a valid Azure Storage connection string before running.
If you found this useful and you want to learn more about C#, .NET, and software engineering, subscribe to the free Dev Leader Weekly newsletter:
Subscribe to Dev Leader Weekly
- All Links
- Website - Dev Leader
- YouTube - Dev Leader
- YouTube - Dev Leader Path To Tech
- YouTube - Dev Leader Podcast
- YouTube - CodeCommute
- Newsletter - Dev Leader Weekly
- LinkedIn - Nick Cosentino
- GitHub - ncosentino
- Twitter/X - Dev Leader
- Threads - Dev Leader
- Bluesky - Dev Leader
- Mastodon - Dev Leader
- Facebook - Dev Leader
- TikTok - Dev Leader
- Twitch - Dev Leader
- Stack Overflow - Nick Cosentino
Powered by BrandGhost 👻