I don't know how to upload an extension attribute, but, I wrote this as it came out of a need.
The mere presence of MobileMeAccounts.plist doesn't tell you if someone is actively signed in to iCloud or not. However, the contents of that plist file will tell you if someone is or is not signed in to iCloud.
This EA was tested in Catalina, and other versions may vary milage. This EA will print the email address used to sign in to iCloud.
#!/bin/sh
## Get logged in user
loggedInUser=$(stat -f%Su /dev/console)
icloudaccount=$( defaults read /Users/$loggedInUser/Library/Preferences/MobileMeAccounts.plist Accounts | grep AccountID | cut -d '"' -f 2)
if [ -z "$icloudaccount" ]
then
echo "<result>Null</result>"
else
echo "<result>$icloudaccount</result>"
fi
