I wrote a small script I can share, that might help.
You can run this script crontab on the server.
It uses ldapsearch so first you need to install that on your proxmoxmachine.
apt-get install ldap-utils
Here is the script
---------------------------------- ad2proxmox-------------------------
#!/bin/bash
# script that adds AD users from a specific group into proxmox based on mailaddress
# change config here
#User that had read access to AD to read all accounts
LDAPBINDUSER='CN=ldapuser,CN=Managed Service Accounts,DC=example,DC=com'
# DN where the Base of the search is..
LDAPBINDDN="CN=Users,DC=example,DC=com"
# the URL of the server and port to connect to.
LDAPURL="ldap://dc.example.com:3268"
# filter to filter out the accounts we want to add.. we use member of Staff group
LDAPFILTER='(&('objectClass=organizationalPerson')('memberOf="cn=Staff,cn=Users,dc=example,dc=com"')(!('mail=Administrator@example.com')))'
# where ldapsearch is.. default for proxmoxmachines
LDAPEXEC="/usr/bin/ldapsearch"
# the password for the LDAPBINDUSER
LDAPPASSWD='!!4rf/&hhfhdHKL!!'
# where the pveum command to add users are. default for proxmox
PVEUMEXE="/usr/sbin/pveum"
# what group you want your LDAP users to be part of in proxmox. I use a group that have Audit rights.
PVEGROUP="users"
$LDAPEXEC -w $LDAPPASSWD -H $LDAPURL -D "$LDAPBINDUSER" -b "$LDAPBINDDN" -s sub $LDAPFILTER mail > tmp1
while read ii
do
if [[ $ii == "mail: "* ]]; then
usermail=$( echo $ii| awk '{ print $2 }' )
echo $usermail
$PVEUMEXE user add $usermail --groups $PVEGROUP
fi
done < tmp1
rm tmp1
-----------------------------------------------------------------------------------------
Enjoy!