Find-CESitMatch.ps1¶
Helper. Connects to your tenant, dumps the canonical SIT list, then for each name in your input CSV suggests the closest tenant match using normalized-exact, substring, and Levenshtein-distance fallbacks. Useful when adapting an externally-sourced SIT list (a planning spreadsheet, a Microsoft docs export) to match the canonical names your tenant actually returns.
Synopsis¶
Parameters¶
| Name | Type | Default | Notes |
|---|---|---|---|
-NamesFile |
string |
required | Path to a CSV containing the source names |
-NamesColumn |
string |
Name |
Which column to read names from |
-OutFile |
string |
sit_mappings.csv in the OS temp folder |
Where to write the mapping CSV (the resolved path is printed at the end) |
Example¶
./scripts/Find-CESitMatch.ps1 -NamesFile ./my-sits.csv
# 50 of 315 names are non-canonical → printed table + sit_mappings.csv in the temp folder
How matching works¶
For each row's Name:
- Normalized-exact - strip non-alphanumerics, lowercase. If equal to a tenant name post-normalization, accept (
exactornormalized-exact). - Substring containment - if either side contains the other after normalization. Pick the candidate whose length is closest (
substring). - Levenshtein distance - compute edit distance against every tenant name; accept the closest if distance ≤ 30% of the source length (
levenshtein-N). - Otherwise →
<<NO MATCH>>.
Output format¶
Printed table and exported CSV:
Source Suggested Type
------ --------- ----
All credentials All Credential Types levenshtein-7
Australia drivers license number Australia Driver's License Number normalized-exact
Germany passport number German Passport Number levenshtein-1
Caveats¶
- Hand-review the Levenshtein matches. The algorithm picks the closest by edit distance, which can produce false positives where unrelated names happen to be similar. We've seen
Czech passport numberget suggested asGreece Passport Number(5 edits, accepted) when the real answer wasCzech Republic Passport Number(8 edits, rejected by threshold). - No automatic apply. The script only suggests - it never writes back to your source CSV. That's intentional: you should eyeball the suggestions before applying.
- Auth required. Connects to Security & Compliance PowerShell on the same
Connect-IPPSSessionflow as the orchestrator.