Just a couple of commands take care of this. What's nice is that this can be automated from the shell, and can thus be included in scripts and in CI (e.g. in Jenkins)
[16:23:59] ~ $ adb -s emulator-5556 pull /data/data/com.android.providers.settings/databases/settings.db 194 KB/s (24576 bytes in 0.123s) [16:38:59] ~ $ sqlite3 settings.db "select value from secure where name='android_id'" 9774d56d682e549cThe output of the sqlite3 command is the required android_id: 9774d56d682e549c