Yeah, I’m talking about capital V Virtualization, the framework that Apple provides for making macOS virtual machines (and is used by this sample code). Signing in with your Apple ID is explicitly not supported in those.
If the macOS you run in an M1 virtual machine is the same macOS, then why is the same not true? And I suppose I wonder whether the officially-supported ESXi-virtualizing-macOS has iCloud support, and how that works.