Hello Richard,
did you use the export function of the user administration of the portal? Then you habe three text files, correct?
If you have a look at, e.g., the one for the users, you'll see, that there isn't just a section about the users in there, but also which groups and roles they have assigned. The same with the other exported files.
You need to edit the files, so that the assigning lines are nit in there for the first upload, which will then create the users, the groups and the roles. And then you can just re-import your original files with the assignments to update the information.
I'm a bit confused though, that you want to import users, too, when you say you have an AD as user data source. Or did I understand that wrong?
Regards,
Steffi.