I restarted the VM, then I logged out/into iCloud again (using my burner account), then I logged into my Apple ID in Xcode (using my real developer account). Today, I got a 2FA request after entering the username/password (that didn't happen yesterday).
Then I tried to build (it failed), so I quit and restarted Xcode, and it worked.
So basically, trial and error :-)
Topic:
Code Signing
SubTopic:
Certificates, Identifiers & Profiles
Tags: