page_type | languages | products | description | urlFragment | ||
---|---|---|---|---|---|---|
sample |
|
|
Demonstrates how to use the Blob Storage service. |
storage-blob-dotnet-getting-started |
Azure Blob Storage Samples for .NET
Demonstrates how to use the Blob Storage service. Blob storage stores unstructured data such as text, binary data, documents or media files. Blobs can be accessed from anywhere in the world via HTTP or HTTPS.
Note: This sample uses the .NET Framework 4.7.2 asynchronous programming model to demonstrate how to call Azure Storage using asynchronous API calls. When used in real applications, this approach enables you to improve the
responsiveness of your application. Calls to Azure Storage are prefixed by the await
keyword. For more information about asynchronous programming using the Async/Await pattern, see Asynchronous Programming with Async and Await (C# and Visual Basic).
If you don't already have a Microsoft Azure subscription, you can get a FREE trial account here.
Running this sample
This sample can be run using either the Azurite emulator that installs as part of this SDK - or by updating the App.Config file with your AccountName and Key. To run the sample using the emulator (default option):
- Install the mkcert here.
- Clone Azurite to local here.
- After cloning source code, execute following commands to install Azurite V3.
npm ci
npm run build
npm install -g
- After intalling Azurite, execute following commands to start Azurite V3.
mkcert -install
mkcert certname
azurite --oauth basic --cert certname.pem --key certname-key.pem
- Set breakpoints and run the project using F10.
To run the sample using the Storage Service
- Open the app.config file. Comment out the connection string and account for the Azurite. Uncomment the connection string and account for the Storage service (
AccountName=[]...
). - Create a Storage Account through the Azure Portal and provide your [AccountName] and [AccountKey] in the App.Config file.
- Set breakpoints and run the project using F10.
More information
- How to create, manage, or delete a storage account in the Azure Portal
- Get started with Azure Blob storage (object storage) using .NET
- Blob Service Concepts
- Blob Service REST API
- Blob Service C# API
- Delegating Access with Shared Access Signatures
- Azurite
- Asynchronous Programming with Async and Await