Orchard Core AI Memory Azure AI Search
Configure Azure AI Search memory indexing
You are an Orchard Core expert. Configure Azure AI Search for persistent user-memory
vector indexing and semantic retrieval. Maintain the strict authenticated-user filter
and use the provider-managed profile mappings.
Guidelines
- Enable the exact feature ID
CrestApps.OrchardCore.AI.Memory.AzureAI. - Its manifest depends on
CrestApps.OrchardCore.AI.Memory,OrchardCore.Indexing, andOrchardCore.AzureAI; the base AI Memory feature is enabled by dependency. - Create AI Memory (Azure AI Search) from Search → Indexing, select its embedding deployment, then choose it in Settings → Artificial Intelligence → Memory.
- Memory remains authenticated-user scoped even though all users can occupy a shared external index.
- The backend registers
AzureAISearchMemoryVectorSearchServiceas a keyedIMemoryVectorSearchServiceusingAzureAISearchConstants.ProviderName. - Install the package in the web or startup project and store Azure endpoint and credential configuration securely.
- Do not use memory to retain secrets, tokens, private keys, payment data, or other sensitive user data.
Provider registrations
| Registration | Purpose |
|---|---|
| AIMemoryAzureAISearchIndexProfileHandler | Creates, updates, and normalizes Azure Search memory mappings. |
| AIMemoryAzureAISearchDocumentIndexHandler | Builds Azure index documents from persisted memory records. |
| AzureAISearchMemoryVectorSearchService | Retrieves semantically similar memories for one user. |
| AddAzureAISearchIndexingSource | Adds AI Memory (Azure AI Search) as an index source. |
Enable the backend
{
"steps": [
{
"name": "Feature",
"enable": [
"CrestApps.OrchardCore.AI",
"CrestApps.OrchardCore.AI.Memory.AzureAI",
"OrchardCore.AzureAI"
],
"disable": []
}
]
}
The base memory feature is dependency-only. Do not treat it as an independent
standalone backend; enable this provider or the Elasticsearch provider alongside it.
Configure the memory index
- Configure the Orchard Core Azure AI Search connection.
- Create an embedding deployment that declares
textEmbedding; the picker lists deployments in theembeddingslot only (seeorchardcore-ai-model-capabilities). - Create AI Memory (Azure AI Search) in Search → Indexing.
- Select the embedding deployment and save the profile. It is stored in
DataSourceIndexProfileMetadata.EmbeddingDeploymentNameand becomes read-only once the index exists. - Select that profile as the Memory Index profile site setting.
- Enable user memory for a supported profile or interaction and test with an authenticated user.
The selected embedding dimensions drive the vector mapping. Changing model dimensions
after memory data exists requires a new compatible index and a planned reindex.
Managed Azure mappings
| Field | Mapping |
|---|---|
| memoryId | Text, key, filterable |
| userId | Text, filterable |
| name | Text, searchable, filterable |
| description | Text, searchable |
| content | Text, searchable |
| updatedUtc | DateTime, filterable, sortable |
| embedding | Searchable vector using the default HNSW profile |
The index-profile handler keeps a default vector profile and default-hnsw
algorithm configuration. It calculates dimensions from the selected deployment,
retains user-defined custom fields, and normalizes duplicate managed mappings when a
profile is loaded or saved.
User-scoped vector retrieval
AzureAISearchMemoryVectorSearchService sends a VectorizedQuery against
embedding and requires:
userId eq '<current authenticated user ID>'
It selects memory ID, name, description, content, and updated time; drops results
without content; orders by score descending; and takes at most topN. Azure request
failures and unexpected errors are logged and return no results.
Never remove the userId filter from a custom implementation. Semantic similarity
alone is not authorization and could expose memory belonging to another user.
Memory retrieval flow
- An authenticated user asks a question.
- The application embeds the query using the profile deployment.
- The Azure-keyed memory search service performs filtered vector search.
- Matching personal memory can be injected as private context or returned by the
memory tool.
- The model responds without treating retrieved memory as a public cross-user corpus.
Troubleshooting
| Symptom | Check |
|---|---|
| Memory index source is absent | Enable OrchardCore.Indexing, OrchardCore.AzureAI, and the exact Azure AI Memory feature. |
| No embedding deployment is selectable | Declare textEmbedding on an embedding deployment; chat deployments are not offered. |
| Memory tool returns nothing | Confirm an authenticated identity, an active memory index profile, saved memory records, and a valid embedding configuration. |
| Index edit duplicates mappings | Reopen and save it. The handler normalizes managed duplicates while retaining custom fields. |
| Search fails | Check Azure endpoint, credentials, network rules, index availability, and vector dimensions. |
| Memories appear cross-user | Treat this as an authorization defect. Verify the active user ID and preserve the mandatory userId filter. |
Security and operations
- Restrict Azure AI Search access by network and application identity.
- Keep connection strings and keys in secret providers.
- Reindex deliberately when changing embeddings or moving to another master index.
- Retain only durable, non-sensitive memory and honor user deletion requests.
- Test search with separate authenticated users to verify isolation.
Profile maintenance
The handler runs when an Azure AI Search memory profile is initialized, created,
updated, and loaded. Reopen a profile through the supported admin experience instead
of manually editing provider metadata:
- Confirm the profile provider is Azure AI Search.
- Verify the intended embedding deployment remains available.
- Save the profile so its managed fields and vector settings are normalized.
- Reindex only after changes that affect vectors, mappings, or the target index.
- Retest retrieval with two authenticated users after every integration change.
Custom fields are retained, but they must not reuse the seven managed memory field
names. Keep custom data and memory authorization rules separate from the mandatory
userId filter.
Index migration checklist
- Create a new profile when a new embedding model has different dimensions.
- Select the new profile only after its index is created and validated.
- Reindex persistent records through the AI Memory indexing lifecycle.
- Verify old and new profiles do not receive concurrent writes beyond the planned
transition period.