Orchardcore ai documents azure storage

From CrestApps/CrestApps.AgentSkills · View interactive version

Orchardcore ai documents azure storage is an AI agent skill from the GitHub repository CrestApps/CrestApps.AgentSkills. Skill for storing CrestApps Orchard Core AI Documents in Azure Blob Storage (CrestApps.OrchardCore 3.0 on Orchard Core 4.0). Covers AIDocumentBlobStorageOptions, the BlobFileStore replacement, Liquid container names and base paths per tenant, tenant container lifecycle, cleanup choices, and Azure co

How to use this skill

Skill file

Orchard Core AI Documents Azure Blob Storage

Configure Azure Blob document storage

You are an Orchard Core expert. Configure CrestApps AI Documents to place uploaded

document files in Azure Blob Storage while preserving the normal document extraction,

chunking, embedding, indexing, and RAG workflow.

Guidelines

What the feature registers

| Registration | Purpose |

|---|---|

| AIDocumentBlobStorageOptionsConfiguration | Binds the tenant shell configuration to AIDocumentBlobStorageOptions. |

| BlobFileStore | Orchard Core Azure Blob file-system implementation. |

| DefaultDocumentFileStore | Wraps the blob store and replaces the default IDocumentFileStore. |

| AIDocumentBlobContainerTenantEvents | Creates or removes tenant storage during tenant lifecycle events. |

AIDocumentBlobStorageOptions derives from MediaBlobStorageOptionsBase. Its storage

settings therefore include the connection string, container name, base path, create,

and removal behavior.

Enable the feature

Enable an AI Documents context or indexing backend as appropriate, then enable Azure

document storage. The base AI Documents capability is enabled by dependency.

{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "CrestApps.OrchardCore.AI.Documents.ChatInteractions",
        "CrestApps.OrchardCore.AI.Documents.Azure",
        "CrestApps.OrchardCore.AI.Documents.AzureAI"
      ],
      "disable": []
    }
  ]
}

The storage feature can also be used with CrestApps.OrchardCore.AI.Documents.Elasticsearch,

Profiles, or Chat Sessions. Do not enable a search provider merely to use Blob Storage

unless the application also needs indexed retrieval.

Configure tenant settings

Configure the tenant under OrchardCore:CrestApps:AI:AzureDocuments.

{
  "OrchardCore": {
    "CrestApps": {
      "AI": {
        "AzureDocuments": {
          "ConnectionString": "Use a secret or environment-variable value here",
          "ContainerName": "ai-documents",
          "BasePath": "tenants/default/documents",
          "CreateContainer": true,
          "RemoveContainer": false,
          "RemoveFilesFromBasePath": true
        }
      }
    }
  }
}

| Option | Behavior |

|---|---|

| ConnectionString | Azure Storage account connection string required to activate the replacement store. |

| ContainerName | Required blob container. Supports Liquid, such as ai-documents-{{ ShellSettings.Name }}; the result must meet Azure naming rules. |

| BasePath | Optional prefix for AI document files. Supports Liquid, such as {{ ShellSettings.Name }}. |

| CreateContainer | Creates the container when a configured tenant activates. |

| RemoveContainer | Deletes the entire container during tenant removal. |

| RemoveFilesFromBasePath | Deletes only blobs beneath BasePath during tenant removal. |

RemoveContainer takes precedence over RemoveFilesFromBasePath. Never enable

RemoveContainer for a container shared by tenants or other applications.

Tenant lifecycle behavior

AIDocumentBlobContainerTenantEvents runs only when valid storage options are present.

On activation, it skips uninitialized tenants and creates the configured container only

when CreateContainer is true. The container is created without public access.

On tenant removal:

  1. If RemoveContainer is true, it deletes the whole configured container.
  2. Otherwise, if RemoveFilesFromBasePath is true, it enumerates blobs with the base

path prefix and deletes each blob.

  1. Azure request failures are logged and are surfaced through the tenant removal

context so the administrator can act on the failed cleanup.

Choose a unique container per tenant when whole-container cleanup is desired. Choose

a tenant-specific BasePath and RemoveFilesFromBasePath when tenants share a

container.

Storage flow

  1. A user uploads a document through a supported AI Documents context.
  2. IDocumentFileStore writes the file through DefaultDocumentFileStore.
  3. With valid Azure settings, that wrapper uses BlobFileStore; otherwise this module

does not replace the application's existing document-file-store registration.

  1. The usual document processor extracts text, chunks it, and optionally indexes the

resulting chunks through the enabled search backend.

Blob Storage does not make a file publicly accessible and does not alter authorization

for upload, download, or document removal.

Separate tenants with Liquid

ContainerName and BasePath are rendered with Liquid and the tenant's ShellSettings

through Orchard Core's blob-storage options pipeline, so one configuration in the root

appsettings.json serves every tenant.

A container per tenant, deleted with the tenant:

{
  "OrchardCore": {
    "CrestApps": {
      "AI": {
        "AzureDocuments": {
          "ConnectionString": "Set through a production secret provider",
          "ContainerName": "ai-documents-{{ ShellSettings.Name }}",
          "CreateContainer": true,
          "RemoveContainer": true
        }
      }
    }
  }
}

One shared container separated by folder, deleting only the tenant's folder:

{
  "OrchardCore": {
    "CrestApps": {
      "AI": {
        "AzureDocuments": {
          "ConnectionString": "Set through a production secret provider",
          "ContainerName": "ai-documents",
          "BasePath": "{{ ShellSettings.Name }}",
          "CreateContainer": true,
          "RemoveContainer": false,
          "RemoveFilesFromBasePath": true
        }
      }
    }
  }
}

The resolved container name is lowercased and must be a valid Azure container name: 3 to

63 characters, lowercase letters, digits, and single hyphens, starting and ending with a

letter or digit. A tenant name with an underscore, for example, resolves to an invalid

name and logs an error when the tenant starts; use the shared container for such tenants.

A tenant's own App_Data/Sites/{tenant}/appsettings.json writes the same keys starting at

CrestApps, without the OrchardCore wrapper.

Troubleshooting

| Symptom | Check |

|---|---|

| Azure storage is not active | Confirm both required settings are non-empty and restart or reactivate the tenant after changing configuration. The module otherwise preserves the pre-existing document-file-store registration. |

| Feature logs configuration errors | Verify the exact OrchardCore:CrestApps:AI:AzureDocuments path and use a valid connection string and container. |

| Container is not created | Set CreateContainer to true and confirm the storage identity can create containers. |

| Tenant removal deletes too much | Disable RemoveContainer for shared containers and use a tenant-specific base path with RemoveFilesFromBasePath. |

| Tenant removal cannot clean up | Confirm delete permissions and inspect the tenant-removal error and Azure request logs. |

| RAG retrieval is unavailable | Blob storage is not an index provider. Enable and configure Azure AI Search or Elasticsearch plus an embedding deployment. |

Security checklist

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.