How can I get the pgAgent Service installed and started on a Windows 10 OS with an AzureAD login?
The pgAgent Service will not start on Windows 10 with a AzureAD login.
My username on this computer is azuread\my_username when I run whoami from the CLI.
I ran EnterpriseDB’s PostgreSQL Stack Installer as an Administrator to install the pgAgent. I tried the following values for the "Operating system username": my_username, azuread\my_username, [email protected], and azuread\[email protected].
Only using my_username worked without error.
However, this created a completely different user named my_username.computername and put the pgpass.conf file in that "users" %APPDATA%\Roaming\postgresql\ directory.
In my actual user profile, I still cannot start the pgAgent Service.
After installing with my_username as the "Operating system username", the pgAgent "Log On As" setting is automatically changed to .\my_username.
When trying to start the Service with "Log On As" set to .\my_username, I get the following message:

When installed with or "Log On As" set to any of the other domain\username options, I get the following error:

When running net start pgAgent-pg16 from an elevated Powershell terminal, I get:
The PostgreSQL Scheduling Agent - pgagent-pg16 service is starting...................
The PostgreSQL Scheduling Agent - pgagent-pg16 service could not be started.
The service did not report an error.
More help is available by typing NET HELPMSG 3534.
How can I get the pgAgent Service installed and started on a Windows 10 OS with an AzureAD login?
Note: I have seen all of the following SO posts and other instructions and none of them help at all.
- Unable to install pgagent with application stack builder
- pgAgent install on Windows error: "required systempassword for user:postgres"
- How can I install pgAgent for PostgreSQL 9.5 on Windows?
- How to install pgAgent service on windows
- could not start pgAgent due to log on failure
- https://dba.stackexchange.com/questions/248538/pgagent-service-for-postgresql-does-not-run
- https://www.pgadmin.org/docs/pgadmin4/latest/pgagent_install.html#service-installation-on-windows
- https://www.postgresql.org/docs/current/libpq-pgpass.html
Additionally, when installed, running either ./pgAgent REMOVE pgAgent or ./pgAgent REMOVE pgAgent-pg16 returns ERROR: Failed to uninstall source, and the following does nothing at all.
./pgAgent INSTALL pgAgent -u my_Win10_username -p my_Win10_password hostaddr=127.0.0.1 dbaname=postgres user=postgres password=***