PurviewTroubleshooting

Exact data match (EDM) in Purview: schema, hashing, upload and the errors that stop it

Why Purview exact data match uploads fail or never match: the EDM_DataUploaders group, schema and data validation, hash and upload commands, indexing and testing.

Exact data match (EDM) lets Microsoft Purview DLP recognize your actual customer or employee records instead of anything that merely looks like an ID number. It's also the classifier with the most moving parts: a schema, an EDM sensitive information type (SIT), a security group, the EDM Upload Agent, hashing, indexing and testing. In this post I'll walk through where each step breaks, the messages you'll see, and how to prove the data is uploaded and matching.

Errors this guide fixes

  • Data upload failedEDM classifiers (Purview portal)
  • Data indexing failedEDM classifiers (Purview portal)
  • UploadDataFailedAudit log / EDM alert policy
  • Command failed. Error Type: System.Configuration.ConfigurationErrorsException Error Message: Invalid AllowedBadLinesPercentage setting: .EdmUploadAgent.exe
How this guide is organized: Symptoms → Why it happens → How to fix it → Verify the fix → Prevent it next timeFlow diagram of the article's sections in reading order: 1. Symptoms. 2. Why it happens. 3. How to fix it (4 steps: Fix the account and authorization; Download the current schema and validate the data; Hash and upload with full paths; Check the session, then fix detection). 4. Verify the fix. 5. Prevent it next time. Toolbox: EdmUploadAgent.exe, Test-DataClassification, Classifiers › EDM classifiers, /UploadData, EDM_DataUploaders.1Symptoms2Why it happens3How to fix it4Verify the fix5Prevent it nexttime1Fix the account andauthorization2Download the currentschema and validate the…3Hash and upload with fullpaths4Check the session, thenfix detectionTOOLBOXEdmUploadAgent.exeTest-DataClassificationClassifiers › EDM classifiers/UploadDataEDM_DataUploadersHow this guide is organized: Symptoms → Why it happens → How to fix it → Verify the fix → Prevent it next timeFlow diagram of the article's sections in reading order: 1. Symptoms. 2. Why it happens. 3. How to fix it (4 steps: Fix the account and authorization; Download the current schema and validate the data; Hash and upload with full paths; Check the session, then fix detection). 4. Verify the fix. 5. Prevent it next time. Toolbox: EdmUploadAgent.exe, Test-DataClassification, Classifiers › EDM classifiers, /UploadData, EDM_DataUploaders.1Symptoms2Why it happens3How to fix it1Fix the account and authorization2Download the current schema and validate thedata3Hash and upload with full paths4Check the session, then fix detection4Verify the fix5Prevent it next timeTOOLBOXEdmUploadAgent.exeTest-DataClassificationClassifiers › EDM classifiers/UploadDataEDM_DataUploaders
At a glance: how this guide is organized · 4 fix steps · 5 key tools

Symptoms#

  • In the new EDM experience, the upload status shows a failure instead of Data upload complete and Indexing complete.
  • An audit search or alert shows the UploadDataFailed activity.
  • EdmUploadAgent.exe stops with an error, or the upload works but the EDM SIT never matches in testing, DLP or auto-labeling.
Text
Data upload failed
Data indexing failed
UploadDataFailed

Admins have also reported this agent error on Microsoft Q&A when running /UploadData:

Text
Command failed. Error Type: System.Configuration.ConfigurationErrorsException Error Message: Invalid AllowedBadLinesPercentage setting: .

Why it happens#

EDM is a chain, and each link has its own typical failure:

StepWhat usually goes wrong
Uploader accountNot a member of the EDM_DataUploaders security group, or the agent was authorized with a different account
SchemaThe schema changed in the portal but the local copy used for hashing is old, so columns don't line up
Data fileCommas or quotes inside values shift the column count; too many bad lines
AgentRun outside its install folder, relative paths, or different agent versions on the hashing and upload computers
RefreshMicrosoft allows up to five refreshes in 24 hours, and each refresh overwrites the whole table
DetectionThe SIT behind a primary field doesn't extract the exact value that was hashed

That last row matters most: Microsoft calls an incorrectly defined SIT on the primary element the most common cause of EDM detection failures. A regex that includes surrounding whitespace (\s), or captures only part of a value, produces text that never matches the hash.

How to fix it#

Fixing the EDM chain, from uploader account to a matching SITStep 1: Add the uploader to EDM_DataUploaders. Then run EdmUploadAgent.exe /Authorize with that account from the install folder. Step 2: Download the schema and validate the data. Re-download after every schema edit; quote values with commas or apostrophes. Step 3: Hash and upload with full paths. Same agent version on both computers; pass /AllowedBadLinesPercentage with a value. Step 4: Check the session and data store. Run /GetDataStore and /GetSession; the portal should show Indexing complete. Step 5: Test the primary element SITs. Use \b instead of \s and capture the whole value. Step 6: Wait an hour, then test the EDM SIT. Expect a match for the EDM SIT itself, not only its primary element SITs.1Add the uploader toEDM_DataUploadersThen run EdmUploadAgent.exe/Authorize with that account fromthe install folder.2Download the schema andvalidate the dataRe-download after every schemaedit; quote values with commas orapostrophes.3Hash and upload with fullpathsSame agent version on bothcomputers; pass/AllowedBadLinesPercentage witha value.4Check the session and datastoreRun /GetDataStore and/GetSession; the portal shouldshow Indexing complete.5Test the primary elementSITsUse \b instead of \s and capturethe whole value.6Wait an hour, then test theEDM SITExpect a match for the EDM SITitself, not only its primary elementSITs.Fixing the EDM chain, from uploader account to a matching SITStep 1: Add the uploader to EDM_DataUploaders. Then run EdmUploadAgent.exe /Authorize with that account from the install folder. Step 2: Download the schema and validate the data. Re-download after every schema edit; quote values with commas or apostrophes. Step 3: Hash and upload with full paths. Same agent version on both computers; pass /AllowedBadLinesPercentage with a value. Step 4: Check the session and data store. Run /GetDataStore and /GetSession; the portal should show Indexing complete. Step 5: Test the primary element SITs. Use \b instead of \s and capture the whole value. Step 6: Wait an hour, then test the EDM SIT. Expect a match for the EDM SIT itself, not only its primary element SITs.1Add the uploader to EDM_DataUploadersThen run EdmUploadAgent.exe /Authorize with thataccount from the install folder.2Download the schema and validate the dataRe-download after every schema edit; quote valueswith commas or apostrophes.3Hash and upload with full pathsSame agent version on both computers; pass/AllowedBadLinesPercentage with a value.4Check the session and data storeRun /GetDataStore and /GetSession; the portal shouldshow Indexing complete.5Test the primary element SITsUse \b instead of \s and capture the whole value.6Wait an hour, then test the EDM SITExpect a match for the EDM SIT itself, not only itsprimary element SITs.
Figure 1 · Process Fixing the EDM chain, from uploader account to a matching SIT. Work through the links in order and stop at the first one that fails; if the upload completes but nothing matches, start with the primary element SITs.

1. Fix the account and authorization#

Add the uploading account to EDM_DataUploaders (a Groups Administrator can do this). On the upload computer (Windows 10 or later, Windows Server 2019 or later, or Windows Server 2016 with .NET 4.6.2), open an elevated Command Prompt in the agent's install folder and run EdmUploadAgent.exe /Authorize, signing in with that account.

2. Download the current schema and validate the data#

Command Prompt
cd "C:\Program Files\Microsoft\EdmUploadAgent"
EdmUploadAgent.exe /SaveSchema /DataStoreName PatientRecords /OutputDir C:\EDM\Schema
EdmUploadAgent.exe /ValidateData /DataFile C:\EDM\Data\PatientRecords.csv /Schema C:\EDM\Schema\PatientRecords.xml

Re-download the schema after every schema edit. If validation complains, fix the export rather than the agent: surround values that contain apostrophes or commas (Tom O'Neil, 's-Gravenhage) with double quotes, or better, export tab-delimited and use the /ColumnSeparator option. For messy CSV quoting, the agent's config file also supports the optional ParseQuotesExhaustiveScenariosByDefault setting.

3. Hash and upload with full paths#

Microsoft recommends two computers: hash on a secure one, upload from an internet-connected one, with the same agent version on both. Always give full paths and an explicit bad-lines threshold:

Command Prompt
REM Secure computer
EdmUploadAgent.exe /CreateHash /DataFile C:\EDM\Data\PatientRecords.csv /HashLocation C:\EDM\Hash /Schema C:\EDM\Schema\PatientRecords.xml /AllowedBadLinesPercentage 5
REM Upload computer (copy the .EdmHash and .EdmSalt files across first)
EdmUploadAgent.exe /UploadHash /DataStoreName PatientRecords /HashFile C:\EDM\Hash\PatientRecords.EdmHash

On a single computer, /UploadData combines both steps with the same /DataFile, /HashLocation, /Schema and /AllowedBadLinesPercentage switches. For the reported Invalid AllowedBadLinesPercentage setting error, use the current agent and pass the switch with a value, as Microsoft's syntax does.

4. Check the session, then fix detection#

Command Prompt
EdmUploadAgent.exe /GetDataStore
EdmUploadAgent.exe /GetSession /DataStoreName PatientRecords

If the upload completed but nothing matches:

  • Test the SIT used by each primary element on its own first. If it misses values or grabs extra characters, use \b instead of \s and capture the whole value (see custom sensitive information types).
  • Avoid loosely defined SITs (any number, any email address) as primary elements; the new experience warns about them.
  • Multi-word values in evidence columns need multi-token matching or a dictionary-based SIT.
  • Check proximity: evidence keywords far from the matched rows don't count.
  • Existing SharePoint and OneDrive files are only reclassified when modified or reindexed, so request a recrawl.

Verify the fix#

  1. /GetDataStore lists the store with a fresh last-updated time, and the portal shows Indexing complete.
  2. Wait at least an hour after indexing, or after any EDM SIT change, before testing.
  3. In the Microsoft Purview portal, open Information Protection › Classifiers › EDM classifiers (with the New EDM experience toggle on), select the SIT, choose Test and upload a file with a few real rows. In the classic experience, test from Sensitive info types instead.
  4. Or test text from PowerShell: Test-DataClassification -ClassificationNames "Patient records EDM" -TextToClassify "...".

Good looks like a match for the EDM SIT itself, not only for its primary element SITs (results show both). Then add it to a DLP policy in simulation; see designing Purview DLP policies.

Prevent it next time#

  • Automate the refresh with Task Scheduler (Microsoft publishes a sample script), keeping the same file name and location and staying within five refreshes in 24 hours.
  • Alert on failures (worldwide and GCC clouds):
    PowerShell
    New-ProtectionAlert -Name "EdmUploadFailAlertPolicy" -Category Others -NotifyUser dlp-team@contoso.com -ThreatType Activity -Operation UploadDataFailed -Description "EDM upload failed" -AggregationType None -Severity High
  • Keep sample data harmless: the new experience can build the schema from a 10–20 row sample file, which isn't hashed, so use made-up values in the real format.
  • Licensing: Microsoft lists EDM-based classification in Office 365 E5, Microsoft 365 E5, Microsoft Purview Suite and Microsoft E5/A5 Information Protection and Governance.

References#

Written and checked against current Microsoft Learn documentation. Test changes with a pilot group before rolling them out to everyone, and if an admin center path has moved since, search for the setting name instead.

Spotted a mistake, or did this fix work differently for you? Email me or message me on LinkedIn — corrections are credited in the article.

Written by

Omer Eltayeb

Intune Subject Matter Expert in Cairo, Egypt, former Microsoft Cloud Solutions Architect, Microsoft Certified Trainer and Microsoft Innovative Educator Expert (2024–26) and Microsoft Elevate Educator Expert (2026–27). I share practical, step-by-step guides, study plans, scripts and toolkits for Microsoft Intune, Configuration Manager, Microsoft Entra ID, Microsoft Defender, Exchange and Microsoft 365 with the community.

Microsoft Certified Trainer (MCT) 2026Microsoft Innovative Educator Expert 2025–2026Microsoft Elevate Educator Expert 2026–2027ISC2 Certified Information Systems Security Professional (CISSP)Microsoft 365 Certified: Enterprise Administrator Expert (MS-102)