This is a knowledgebase item. Hope it helps you out someday.
Error
Add work or school account in Windows 10 or 11 fails with this message: “add account operation is blocked by policy on the device”. Error code: CAA50101

Solution
Check the value of Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WorkplaceJoin\BlockAADWorkplaceJoin
Change the value to 0.

If this device is managed by your organization, you might not able to change this. Please contact your administrator, if that is the case.