PGLN.Media.Storage.Azure 1.0.0-storage-azure

This is a prerelease version of PGLN.Media.Storage.Azure.
dotnet add package PGLN.Media.Storage.Azure --version 1.0.0-storage-azure
                    
NuGet\Install-Package PGLN.Media.Storage.Azure -Version 1.0.0-storage-azure
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PGLN.Media.Storage.Azure" Version="1.0.0-storage-azure" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PGLN.Media.Storage.Azure" Version="1.0.0-storage-azure" />
                    
Directory.Packages.props
<PackageReference Include="PGLN.Media.Storage.Azure" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PGLN.Media.Storage.Azure --version 1.0.0-storage-azure
                    
#r "nuget: PGLN.Media.Storage.Azure, 1.0.0-storage-azure"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PGLN.Media.Storage.Azure@1.0.0-storage-azure
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PGLN.Media.Storage.Azure&version=1.0.0-storage-azure&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=PGLN.Media.Storage.Azure&version=1.0.0-storage-azure&prerelease
                    
Install as a Cake Tool

PGLN.Media.Storage.Azure

Azure Blob Storage implementation of IMediaStorage for the PGLN.Media ecosystem.

Features

  • Stores files in Azure Blob Storage with unique blob names
  • Automatically creates container if it doesn't exist
  • Configurable blob prefix (virtual folders)
  • Fully asynchronous with cancellation token support
  • Returns blob URI for public access scenarios

Installation

dotnet add package PGLN.Media.Storage.Azure

Configuration
appsettings.json
json
{
  "AzureBlobStorage": {
    "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=...;AccountKey=...;EndpointSuffix=core.windows.net",
    "ContainerName": "media-files",
    "BlobPrefix": "uploads/",
    "CreateContainerIfNotExists": true
  }
}
Program.cs / Startup.cs
csharp
using PGLN.Media.Storage.Azure;
using PGLN.Media.Abstractions;

// Configure options
services.Configure<AzureBlobOptions>(
    Configuration.GetSection("AzureBlobStorage"));

// Register storage
services.AddSingleton<IMediaStorage, AzureBlobStorage>();
Usage
csharp
public class FileUploadService
{
    private readonly IMediaStorage _storage;
    
    public FileUploadService(IMediaStorage storage)
    {
        _storage = storage;
    }
    
    public async Task<string> UploadAsync(Stream fileStream, string fileName, string contentType)
    {
        // Save to Azure Blob Storage
        var blobPath = await _storage.SaveAsync(fileStream, fileName, contentType);
        
        // If you need the URL (requires public container or SAS token)
        if (_storage is AzureBlobStorage azureStorage)
        {
            var uri = azureStorage.GetBlobUri(blobPath);
            Console.WriteLine($"File available at: {uri}");
        }
        
        return blobPath;
    }
    
    public async Task<Stream> DownloadAsync(string blobPath)
    {
        return await _storage.GetAsync(blobPath);
    }
    
    public async Task<bool> DeleteAsync(string blobPath)
    {
        return await _storage.DeleteAsync(blobPath);
    }
}

Requirements
Azure Storage account

.NET 8.0 or later

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-storage-azure 93 3/16/2026