Open Closed

Integrating ABP Suite File Components with Azure Blob Storage #9996


User avatar
0
chrisalves created

Check the docs before asking a question: https://abp.io/docs/latest Check the samples to see the basic tasks: https://abp.io/docs/latest/samples The exact solution to your question may have been answered before, and please first use the search on the homepage.

Provide us with the following info: 🧐 Hint: If you are using the ABP Studio, you can see all the information about your solution from the configuration window, which opens when you right-click on the solution and click on the Solution Configuration button.

Template: app Created ABP Studio Version: 0.9.25 Current ABP Studio Version: 1.0.1 ABP Suite: 9.2.0 ABP framework: 9.2.1 Tiered: Yes Multi-Tenancy: Yes UI Framework: blazor-server Theme: leptonx Theme Style: system Run Install Libs: Yes Database Provider: ef Database Management System: sqlserver Separate Tenant Schema: Yes Create Initial Migration: Yes Run Db Migrator: Yes Mobile Framework: maui Public Website: Yes Include Tests: Yes Kubernetes Configuration: No Distributed Event Bus: rabbitmq Use Local References: No Optional Modules: GDPR FileManagement TextTemplateManagement LanguageManagement AuditLogging Chat OpenIddictAdmin Selected Languages: English, English (United Kingdom), 简体中文, Español, العربية, हिन्दी, Português (Brasil), Français, Русский, Deutsch (Deuthschland), Türkçe, Italiano, Čeština, Magyar, Română (România), Svenska, Suomi, Slovenčina, Íslenska, 繁體中文

Default Language: English

Create Command: abp new NewApp -t app --tiered --ui-framework blazor-server --mobile maui --database-provider ef --database-management-system sqlserver --theme leptonx --separate-tenant-schema --public-website --without-cms-kit --dont-run-bundling -chat -file-management

Hello!

I am trying to implement the integration of the original File components and implementation generated by Abp Suite with my implementation of Azure Blob Storage and im facing some difficulties in the process.

As abp already implements with the File property type of abp suite, the file is been saved on a container pointing to the local database with its FileDescriptor within the function UploadFileAsync():

I've followed the documentation present in: https://abp.io/docs/latest/framework/infrastructure/blob-storing https://abp.io/docs/latest/framework/infrastructure/blob-storing/azure

However, the documentation does not clearly outline the best approach to replace the default local storage mechanism with Azure Blob Storage, especially while maintaining compatibility with the components generated by ABP Suite.

I would appreciate guidance on the recommended way to redirect file uploads to Azure Blob Storage instead of the local container, while ensuring that metadata and file descriptors continue to be handled correctly by the framework.

Thanks.


2 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent

    To redirect file uploads from the default local (database) storage to Azure Blob Storage in an ABP Suite-generated application, while maintaining compatibility with the file components and metadata handling, follow these steps:

    1. Add Azure Blob Storage Module Dependency Ensure your module (typically the application or web module) depends on the Azure Blob Storage provider:
    [DependsOn(
           typeof(AbpBlobStoringAzureModule)
       )]
       public class YourAppNameApplicationModule : AbpModule
       {
       }
    
    1. Configure Azure Blob Storage as the Provider In your module's ConfigureServices method, configure the default blob container to use Azure:
    Configure<AbpBlobStoringOptions>(options =>
       {
           options.Containers.ConfigureDefault(container =>
           {
               container.UseAzure(azure =>
               {
                   azure.ConnectionString = "Your_Azure_Connection_String";
                   azure.ContainerName = "your-container-name";
                   azure.CreateContainerIfNotExists = true;
               });
           });
       });
    
    • Place this configuration in the module where your file upload logic resides (commonly the .Application or .Web project).
    1. No Changes Needed in ABP Suite-Generated File Components The ABP Suite-generated file upload logic (as shown in your screenshot) uses IBlobContainer. By configuring the default provider as above, all calls to _blobContainer.SaveAsync(...) will automatically use Azure Blob Storage instead of the local database.

    2. File Metadata and Descriptors The file metadata (such as FileDescriptor) will continue to be stored in your database as before. Only the binary content will be redirected to Azure Blob Storage. The framework will handle the association between the metadata and the actual file content.

    3. Migration Note

      • If you have existing files in the database and want to migrate them to Azure, you will need to implement a migration process to move the blobs and update references as needed.
    4. Testing

      • After configuration, upload a file using your existing ABP Suite-generated UI/component. The file should now be stored in Azure Blob Storage, and metadata will remain in your database.

    This approach ensures seamless integration with ABP Suite-generated file components and maintains all metadata and descriptor handling.

    Sources:

    • https://abp.io/docs/latest/framework/infrastructure/blob-storing
    • https://abp.io/docs/latest/framework/infrastructure/blob-storing/azure

    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    chrisalves created

    I've successfully implemented the configuration for Azure Blob Storage as described in the official documentation. However, my question is more focused on the architectural design required to make this integration scalable and efficient across all modules of my solution.

    Specifically, I'm looking to understand:

    • What is the recommended architecture to fully integrate Azure Blob Storage with the file handling components generated by ABP Suite?
    • Where in the code generated by ABP Suite (especially in Razor Pages and related file components) should I replace or extend the default logic to redirect file uploads from local database storage to Azure Blob Storage?
    • Is it advisable to create a centralized service or abstraction layer to manage blob operations across modules? If so, what would be the best practice for implementing this in a modular and maintainable way?

    The documentation provides a good starting point for configuring blob storage, but it doesn't clearly outline how to adapt the ABP Suite-generated file logic to use Azure Blob Storage as the primary storage backend.

    I would greatly appreciate any guidance or examples that clarify the best approach to achieve this integration in a clean and scalable manner.

    Thank you!

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on October 14, 2025, 08:24