Knowledge Bases - Create Or Update
Creates a new knowledge base or updates a knowledge base if it already exists.
PUT https:///knowledgebases('{knowledgeBaseName}')?api-version=2025-11-01-preview
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
knowledge
|
path | True |
string |
The name of the knowledge base. |
|
api-version
|
query | True |
string minLength: 1 |
The API version to use for this operation. |
Request Header
| Name | Required | Type | Description |
|---|---|---|---|
| Accept | True |
The Accept header. |
|
| If-Match |
string |
Defines the If-Match condition. The operation will be performed only if the ETag on the server matches this value. |
|
| If-None-Match |
string |
Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. |
|
| Prefer | True |
For HTTP PUT requests, instructs the service to return the created/updated resource on success. |
|
| x-ms-client-request-id |
string (uuid) |
An opaque, globally-unique, client-generated string identifier for the request. |
Request Body
| Name | Required | Type | Description |
|---|---|---|---|
| knowledgeSources | True |
Knowledge sources referenced by this knowledge base. |
|
| name | True |
string |
The name of the knowledge base. |
| @odata.etag |
string |
The ETag of the knowledge base. |
|
| answerInstructions |
string |
Instructions considered by the knowledge base when generating answers. |
|
| description |
string |
The description of the knowledge base. |
|
| encryptionKey |
A description of an encryption key that you create in Azure Key Vault. |
||
| models | KnowledgeBaseModel[]: |
Contains configuration options on how to connect to AI models. |
|
| outputMode |
The output mode for the knowledge base. |
||
| retrievalInstructions |
string |
Instructions considered by the knowledge base when developing query plan. |
|
| retrievalReasoningEffort | KnowledgeRetrievalReasoningEffort: |
The retrieval reasoning effort configuration. |
Responses
| Name | Type | Description |
|---|---|---|
| 200 OK |
The request has succeeded. |
|
| 201 Created |
The request has succeeded and a new resource has been created as a result. |
|
| Other Status Codes |
An unexpected error response. |
Security
api-key
Type:
apiKey
In:
header
OAuth2Auth
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize
Scopes
| Name | Description |
|---|---|
| https://search.azure.com/.default |
Examples
SearchServiceCreateOrUpdateKnowledgeBase
Sample request
PUT https:///knowledgebases('base-preview-test')?api-version=2025-11-01-preview
{
"name": "base-preview-test",
"knowledgeSources": [
{
"name": "ks-preview-test"
}
],
"models": [
{
"azureOpenAIParameters": {
"resourceUri": "https://test-sample.openai.azure.com/",
"deploymentId": "myDeployment",
"apiKey": "api-key",
"modelName": "gpt-4o-mini"
},
"kind": "azureOpenAI"
}
],
"retrievalReasoningEffort": {
"kind": "low"
},
"outputMode": "extractiveData",
"@odata.etag": "0x1234568AE7E58A1",
"encryptionKey": {
"keyVaultKeyName": "myUserManagedEncryptionKey-createdinAzureKeyVault",
"keyVaultKeyVersion": "myKeyVersion-32charAlphaNumericString",
"keyVaultUri": "https://myKeyVault.vault.azure.net",
"accessCredentials": {
"applicationId": "00000000-0000-0000-0000-000000000000",
"applicationSecret": "<applicationSecret>"
}
},
"description": "Description of the knowledge base.",
"retrievalInstructions": "Instructions for retrieval for the knowledge base.",
"answerInstructions": "Instructions for answer synthesis."
}
Sample response
{
"@odata.etag": "0x1234568AE7E58A1",
"name": "base-preview-test",
"description": "Description of the knowledge base.",
"retrievalInstructions": "Instructions for retrieval for the knowledge base.",
"answerInstructions": "Instructions for answer synthesis.",
"outputMode": "extractiveData",
"knowledgeSources": [
{
"name": "ks-preview-test"
}
],
"models": [
{
"kind": "azureOpenAI",
"azureOpenAIParameters": {
"resourceUri": "https://test-sample.openai.azure.com/",
"deploymentId": "myDeployment",
"apiKey": "api-key",
"modelName": "gpt-4o-mini"
}
}
],
"encryptionKey": {
"keyVaultKeyName": "myUserManagedEncryptionKey-createdinAzureKeyVault",
"keyVaultKeyVersion": "myKeyVersion-32charAlphaNumericString",
"keyVaultUri": "https://myKeyVault.vault.azure.net",
"accessCredentials": {
"applicationId": "00000000-0000-0000-0000-000000000000",
"applicationSecret": "<applicationSecret>"
}
},
"retrievalReasoningEffort": {
"kind": "low"
}
}
{
"@odata.etag": "0x1234568AE7E58A1",
"name": "base-preview-test",
"description": "Description of the knowledge base.",
"retrievalInstructions": "Instructions for retrieval for the knowledge base.",
"answerInstructions": "Instructions for answer synthesis.",
"outputMode": "extractiveData",
"knowledgeSources": [
{
"name": "ks-preview-test"
}
],
"models": [
{
"kind": "azureOpenAI",
"azureOpenAIParameters": {
"resourceUri": "https://test-sample.openai.azure.com/",
"deploymentId": "myDeployment",
"apiKey": "api-key",
"modelName": "gpt-4o-mini"
}
}
],
"encryptionKey": {
"keyVaultKeyName": "myUserManagedEncryptionKey-createdinAzureKeyVault",
"keyVaultKeyVersion": "myKeyVersion-32charAlphaNumericString",
"keyVaultUri": "https://myKeyVault.vault.azure.net",
"accessCredentials": {
"applicationId": "00000000-0000-0000-0000-000000000000",
"applicationSecret": "<applicationSecret>"
}
},
"retrievalReasoningEffort": {
"kind": "low"
}
}
Definitions
| Name | Description |
|---|---|
| Accept |
The Accept header. |
|
Azure |
The Azure Open AI model name that will be called. |
|
Azure |
Specifies the parameters for connecting to the Azure OpenAI resource. |
|
Error |
The resource management error additional info. |
|
Error |
The error detail. |
|
Error |
Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). |
|
Knowledge |
Represents a knowledge base definition. |
|
Knowledge |
Specifies the Azure OpenAI resource used to do query planning. |
|
Knowledge |
The AI model to be used for query planning. |
|
Knowledge |
Run knowledge retrieval with low reasoning effort. |
|
Knowledge |
Run knowledge retrieval with medium reasoning effort. |
|
Knowledge |
Run knowledge retrieval with minimal reasoning effort. |
|
Knowledge |
The output configuration for this retrieval. |
|
Knowledge |
The amount of effort to use during retrieval. |
|
Knowledge |
Reference to a knowledge source. |
| Prefer |
For HTTP PUT requests, instructs the service to return the created/updated resource on success. |
|
Search |
Clears the identity property of a datasource. |
|
Search |
Specifies the identity for a datasource to use. |
|
Search |
A customer-managed encryption key in Azure Key Vault. Keys that you create and manage can be used to encrypt or decrypt data-at-rest, such as indexes and synonym maps. |
Accept
The Accept header.
| Value | Description |
|---|---|
| application/json;odata.metadata=minimal |
AzureOpenAIModelName
The Azure Open AI model name that will be called.
| Value | Description |
|---|---|
| text-embedding-ada-002 |
TextEmbeddingAda002 model. |
| text-embedding-3-large |
TextEmbedding3Large model. |
| text-embedding-3-small |
TextEmbedding3Small model. |
| gpt-4o |
Gpt4o model. |
| gpt-4o-mini |
Gpt4oMini model. |
| gpt-4.1 |
Gpt41 model. |
| gpt-4.1-mini |
Gpt41Mini model. |
| gpt-4.1-nano |
Gpt41Nano model. |
| gpt-5 |
Gpt5 model. |
| gpt-5-mini |
Gpt5Mini model. |
| gpt-5-nano |
Gpt5Nano model. |
AzureOpenAIVectorizerParameters
Specifies the parameters for connecting to the Azure OpenAI resource.
| Name | Type | Description |
|---|---|---|
| apiKey |
string |
API key of the designated Azure OpenAI resource. |
| authIdentity | SearchIndexerDataIdentity: |
The user-assigned managed identity used for outbound connections. |
| deploymentId |
string |
ID of the Azure OpenAI model deployment on the designated resource. |
| modelName |
The name of the embedding model that is deployed at the provided deploymentId path. |
|
| resourceUri |
string (uri) |
The resource URI of the Azure OpenAI resource. |
ErrorAdditionalInfo
The resource management error additional info.
| Name | Type | Description |
|---|---|---|
| info |
|
The additional info. |
| type |
string |
The additional info type. |
ErrorDetail
The error detail.
| Name | Type | Description |
|---|---|---|
| additionalInfo |
The error additional info. |
|
| code |
string |
The error code. |
| details |
The error details. |
|
| message |
string |
The error message. |
| target |
string |
The error target. |
ErrorResponse
Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.).
| Name | Type | Description |
|---|---|---|
| error |
The error object. |
KnowledgeBase
Represents a knowledge base definition.
| Name | Type | Description |
|---|---|---|
| @odata.etag |
string |
The ETag of the knowledge base. |
| answerInstructions |
string |
Instructions considered by the knowledge base when generating answers. |
| description |
string |
The description of the knowledge base. |
| encryptionKey |
A description of an encryption key that you create in Azure Key Vault. |
|
| knowledgeSources |
Knowledge sources referenced by this knowledge base. |
|
| models | KnowledgeBaseModel[]: |
Contains configuration options on how to connect to AI models. |
| name |
string |
The name of the knowledge base. |
| outputMode |
The output mode for the knowledge base. |
|
| retrievalInstructions |
string |
Instructions considered by the knowledge base when developing query plan. |
| retrievalReasoningEffort | KnowledgeRetrievalReasoningEffort: |
The retrieval reasoning effort configuration. |
KnowledgeBaseAzureOpenAIModel
Specifies the Azure OpenAI resource used to do query planning.
| Name | Type | Description |
|---|---|---|
| azureOpenAIParameters |
Azure OpenAI parameters. |
|
| kind |
string:
azure |
The AI model to be used for query planning. |
KnowledgeBaseModelKind
The AI model to be used for query planning.
| Value | Description |
|---|---|
| azureOpenAI |
Use Azure Open AI models for query planning. |
KnowledgeRetrievalLowReasoningEffort
Run knowledge retrieval with low reasoning effort.
| Name | Type | Description |
|---|---|---|
| kind |
string:
low |
The kind of reasoning effort. |
KnowledgeRetrievalMediumReasoningEffort
Run knowledge retrieval with medium reasoning effort.
| Name | Type | Description |
|---|---|---|
| kind |
string:
medium |
The kind of reasoning effort. |
KnowledgeRetrievalMinimalReasoningEffort
Run knowledge retrieval with minimal reasoning effort.
| Name | Type | Description |
|---|---|---|
| kind |
string:
minimal |
The kind of reasoning effort. |
KnowledgeRetrievalOutputMode
The output configuration for this retrieval.
| Value | Description |
|---|---|
| extractiveData |
Return data from the knowledge sources directly without generative alteration. |
| answerSynthesis |
Synthesize an answer for the response payload. |
KnowledgeRetrievalReasoningEffortKind
The amount of effort to use during retrieval.
| Value | Description |
|---|---|
| minimal |
Does not perform any source selections, query planning, or iterative search. |
| low |
Use low reasoning during retrieval. |
| medium |
Use a moderate amount of reasoning during retrieval. |
KnowledgeSourceReference
Reference to a knowledge source.
| Name | Type | Description |
|---|---|---|
| name |
string |
The name of the knowledge source. |
Prefer
For HTTP PUT requests, instructs the service to return the created/updated resource on success.
| Value | Description |
|---|---|
| return=representation |
SearchIndexerDataNoneIdentity
Clears the identity property of a datasource.
| Name | Type | Description |
|---|---|---|
| @odata.type |
string:
#Microsoft. |
A URI fragment specifying the type of identity. |
SearchIndexerDataUserAssignedIdentity
Specifies the identity for a datasource to use.
| Name | Type | Description |
|---|---|---|
| @odata.type |
string:
#Microsoft. |
A URI fragment specifying the type of identity. |
| userAssignedIdentity |
string |
The fully qualified Azure resource Id of a user assigned managed identity typically in the form "/subscriptions/12345678-1234-1234-1234-1234567890ab/resourceGroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId" that should have been assigned to the search service. |
SearchResourceEncryptionKey
A customer-managed encryption key in Azure Key Vault. Keys that you create and manage can be used to encrypt or decrypt data-at-rest, such as indexes and synonym maps.
| Name | Type | Description |
|---|---|---|
| accessCredentials.applicationId |
string |
An AAD Application ID that was granted the required access permissions to the Azure Key Vault that is to be used when encrypting your data at rest. The Application ID should not be confused with the Object ID for your AAD Application. |
| accessCredentials.applicationSecret |
string |
The authentication key of the specified AAD application. |
| identity | SearchIndexerDataIdentity: |
An explicit managed identity to use for this encryption key. If not specified and the access credentials property is null, the system-assigned managed identity is used. On update to the resource, if the explicit identity is unspecified, it remains unchanged. If "none" is specified, the value of this property is cleared. |
| keyVaultKeyName |
string |
The name of your Azure Key Vault key to be used to encrypt your data at rest. |
| keyVaultKeyVersion |
string |
The version of your Azure Key Vault key to be used to encrypt your data at rest. |
| keyVaultUri |
string |
The URI of your Azure Key Vault, also referred to as DNS name, that contains the key to be used to encrypt your data at rest. An example URI might be |