Deleting a SharePoint Data Source From a Bedrock Knowledge Base Set to RETAIN Leaves Its Text in the Vector Store
Overview
Removing a SharePoint source from a Bedrock knowledge base set to RETAIN keeps its text in the vector store. Switch the policy to DELETE first.
At a glance
- Symptom
- Deleting a SharePoint Online data source from an Amazon Bedrock knowledge base removes the connector, but if its data deletion policy is RETAIN, every…
- Likely cause
- The data deletion policy, not the delete action, decides what happens to synced content.
- Impact
- The retained text sits outside SharePoint's permissions and outside the knowledge base's lifecycle.
- Verification signal
- A successful deletion ends with the source missing from list-data-sources, not stuck in a failed state.
- Safe correction
- Change the policy on the live data source first, confirm it, and delete only after that.
- Rollback or recovery
- Each step before the deletion can be reversed with the files you saved.
Symptom
Deleting a SharePoint Online data source from an Amazon Bedrock knowledge base removes the connector, but if its data deletion policy is RETAIN, every chunk of SharePoint text it synced stays in the vector store. The console shows a green banner, the source disappears from the list, and the site looks disconnected. The embeddings and the raw text Bedrock wrote alongside them are still in the vector index. Deleting the whole knowledge base doesn’t remove them either. The fix is an order of operations: read the policy, change it to DELETE with update-data-source, confirm it, and only then delete the data source and watch for DELETE_UNSUCCESSFUL.
A typical case: a team stops indexing an HR or legal SharePoint site because its content should no longer be searchable through an assistant. The data source goes, the ticket closes, and the text stays in a store that SharePoint permissions never governed.
Why removing the data source looks safe
Deleting the data source feels like the end of the connection. The SharePoint site is untouched, the Entra ID app can be retired afterwards, and the knowledge base no longer lists the source. The deletion policy is set once, when the data source is created or modified, and nobody looks at it again when it is removed.
Root cause
The data deletion policy, not the delete action, decides what happens to synced content. The Amazon Bedrock API reference defines two values for dataDeletionPolicy. DELETE deletes all data from the data source that has been converted into vector embeddings when the data source or knowledge base is deleted. RETAIN keeps all of that data in the same situation. With either value, the vector store itself is never deleted.
What stays is more than numbers. When you set up a vector store for a knowledge base, you map a text field that AWS describes as the field in which to store the raw text from your data sources, next to the vector field and a metadata field Bedrock manages. So a retained SharePoint source leaves readable passages of its documents behind, not only embeddings.
This applies to knowledge bases backed by a vector store you supply. For an Amazon Bedrock managed knowledge base, AWS documents DELETE as the only supported option and the default.
Impact
The retained text sits outside SharePoint’s permissions and outside the knowledge base’s lifecycle. The SharePoint connector page warns that all data synced from the source becomes available to anyone with bedrock:Retrieve permission on the knowledge base, including data that had controlled permissions in the source. Removing the source is how most teams try to take that exposure away. With RETAIN, the text is still readable by anyone who can read the vector index, and it stays there after the SharePoint documents are deleted or restricted. It is the same pattern as S3 default encryption, which never touches objects uploaded before it was enabled: the setting you rely on doesn’t act on data that already exists.
Shortcuts that make it worse
Deleting the whole knowledge base looks thorough. It isn’t: RETAIN covers deletion of the knowledge base as well as the data source, and the vector store is not deleted. You lose the configuration of every other source and the SharePoint text remains.
Deleting the vector index or collection by hand does remove the text, along with the embeddings of every other data source stored in it. That is a destructive change outside Bedrock, and the only way back is to rebuild the index and sync every source again.
Revoking the Entra ID app’s Sites.Read.All consent, or deleting its client secret, stops future syncs. Nothing in that change touches what is already in the index. Leave it until last, because you need those credentials if you have to recreate and re-sync the source.
How to confirm the policy before you delete
Two read-only AWS CLI calls show which sources are affected. List the data sources in the knowledge base:
aws bedrock-agent list-data-sources --knowledge-base-id KB12345678 --query "dataSourceSummaries[].[dataSourceId,name,status]"
Then read the policy and status of the SharePoint source:
aws bedrock-agent get-data-source --knowledge-base-id KB12345678 --data-source-id DS12345678 --query "dataSource.[name,dataDeletionPolicy,status]"
If the second value is RETAIN, deleting this source now leaves its text in the vector store. If the source is already gone and was set to RETAIN, Bedrock’s data source calls can no longer reach that text. Deleting the knowledge base won’t remove it either. The clean-up becomes a separate, reviewed change in the vector store, made by whoever owns that store.
Correction
Change the policy on the live data source first, confirm it, and delete only after that. Before you start, check that SharePoint is still the system of record for every document the source indexes, so that a re-sync can rebuild anything removed by mistake, and that you hold bedrock:GetDataSource and bedrock:UpdateDataSource. AWS’s knowledge base permissions page says to treat data source actions as privileged, so make this change through your normal change process.
- Back up the full data source definition, then extract the two parts the update needs:
aws bedrock-agent get-data-source --knowledge-base-id KB12345678 --data-source-id DS12345678 --query "dataSource" --output json > ds-backup.json aws bedrock-agent get-data-source --knowledge-base-id KB12345678 --data-source-id DS12345678 --query "dataSource.dataSourceConfiguration" --output json > ds-config.json aws bedrock-agent get-data-source --knowledge-base-id KB12345678 --data-source-id DS12345678 --query "dataSource.vectorIngestionConfiguration" --output json > ds-vector.jsonUpdateDataSourcerequires the name and the data source configuration, and the chunking configuration can’t be changed after creation, so pass the existing one back unchanged. Ifds-vector.jsoncontains onlynull, leave the--vector-ingestion-configurationoption out. Ifds-backup.jsonshows adescriptionor aserverSideEncryptionConfiguration, pass those back as well with--descriptionand--server-side-encryption-configuration, so the update changes nothing but the policy. - Switch the policy, keeping everything else as it was. Use the name the earlier check returned:
aws bedrock-agent update-data-source --knowledge-base-id KB12345678 --data-source-id DS12345678 --name hr-sharepoint --data-source-configuration file://ds-config.json --vector-ingestion-configuration file://ds-vector.json --data-deletion-policy DELETEStop if the call returns an error. Nothing has been deleted at this point.
- Run the
get-data-sourcecheck again and confirm it now reportsDELETEandAVAILABLE. - Delete the data source. In the console, choose Knowledge bases in the left navigation pane, open the knowledge base, select the source in the Data source section and choose Delete, or send a
DeleteDataSourcerequest. This removes the synced data from the vector store and can’t be undone; the recovery path is to recreate the source and sync it again. - Only after the source has gone, and after checking with
get-data-sourcethat no other data source names the samecredentialsSecretArn, retire the Entra ID client secret and the AWS Secrets Manager secret that held it. AWS advises against reusing credentials across data sources, but check rather than assume.
Validation
A successful deletion ends with the source missing from list-data-sources, not stuck in a failed state. Run the list command again. A source still shown as DELETING is in progress. A source shown as DELETE_UNSUCCESSFUL means Bedrock couldn’t remove the data, which AWS says can happen because of problems with the configuration of, or access to, the vector store. Read the reason:
aws bedrock-agent get-data-source --knowledge-base-id KB12345678 --data-source-id DS12345678 --query "dataSource.failureReasons"
Fix the access problem it names and delete again. Then have the owner of the vector store confirm that no records from the SharePoint site remain in the index.
Rollback
Each step before the deletion can be reversed with the files you saved. To undo the policy change, run the same update-data-source command with --data-deletion-policy RETAIN. After the deletion there is nothing to roll back in place: create a new SharePoint data source from the configuration in ds-backup.json and sync it, which rebuilds the index from SharePoint. That only works while the Entra ID app and its secret still exist, which is why they go last.
Prevent it on the next SharePoint source
Set dataDeletionPolicy explicitly when you create every data source, rather than relying on whatever the tool you use fills in, and record the value in the change that creates it. Add the get-data-source check to the steps for decommissioning a source, so the policy is read before anyone presses Delete. Keep data source permissions with the few people who own the knowledge base. For a related case of a clean-up deleting the wrong thing because the order was wrong, see how expiring untagged ECR images removes a digest an ECS service still runs.
Apply the safer control
Before you change production
Confirm the affected scope, export the current configuration, and test the replacement control in a non-production environment first.
Fix commands and configuration
RETAINDELETEupdate-data-sourceWhen to escalate
Validation and rollback are covered in the sections above.
Escalate
Escalate when the blast radius is uncertain, the control cannot be tested safely, or remediation requires an outage or security exception.
Fixed? Get the next one before it hits you: The KBY Brief
Practical fixes for the systems you run, by email about twice a week. Unsubscribe at any time.
About this page
Credited to
Dates
Published
Corrections
No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.
Was this useful?
Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.