Difference between id and groups

What's the difference between groups and id-a.

We're using LDAP, rather than NIS+, and a user has been added to an extra Unix group. The groups command shows the new group but id -a doesn't!

Why would this be?

the session of the user is attached to a primary group id
this primary group id is diplayed with the id command.

If the user want his session be active with another group id (for example, one of the possible secondary group id) he can switch of activ group id using the newgrp command

Note that this will not change his default group id (if he disconnect / reconnect, he will be back in is primary group id).

see -g and -G option of useradd/usermod

you can try to newgrp you user to a <secondary_group_id> and do id again

by the way, the output of your id command may depends on your OS

# id
uid=0(root) gid=0(root) 
# newgrp sys
# id
uid=0(root) gid=3(sys) 
#

Thanks, but I don't want to change groups. I simply want to understand why the groups and id outputs differ.

then you have to go through the RTFM part ...

man id 
man groups

...
maybe historical reasons ...

# id -a
uid=0(root) gid=0(root) groups=0(root),1(other),2(bin),3(sys),4(adm),5(uucp),6(mail),7(tty),8(lp),9(nuucp),12(daemon)
# groups
root other bin sys adm uucp mail tty lp nuucp daemon
#

Maybe it depends some OS but as you see for example on a Sun Sparc system :
id -a show not only the groupname but also the corresponding groups id whereas the output of groups only show the name of the group the user belong to, by the way this output may require less parsing if you use it in a script

...but in your example it's the same set of groups for either command.

I'm seeing an extra group running groups than I see with id -a.

how did you add the user to a second group? POSIX allows up to 16 groups for a user.