We have configured AD Import in SharePoint 2013 with an LDAP filter set. After some time we discovered, that accounts deleted from AD are not automatically deleted from SharePoint.
After a lot of debugging and testing I found the solution:
The LDAP filter is an "Include" filter so you have to define which accounts should be imported. The filter looked like:
(Import all accounts which are not service accounts and belong to MyCompany1 or MyCompany2)
You see the issue? Deleted accounts are not included in the filter, so I had to change the filter to include "isDeleted":
Now also deleted accounts are included and SharePoint will delete the profiles correctly.
Maybe Microsoft should mention this in the documentation. Currently there is only one sentence regarding the LDAP filter:
If you want to filter the objects that you import from the directory service, in the Filter in LDAP syntax for Active Directory Import box, type a standard LDAP query expression to define the filter.