@Eudelio Benitez Gonzalez I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.
Issue:
Following I explain my scenario.
I created a VM image version from a generalized machine. That machine has the ad login extension installed and Enable the Azure AD login option enabled.
From the version I create vms but I can't see the machines in the azure ad devices, so I can't enter using my AD credentials, more over, all the machines have the same device id.
I need to understand how a VM is register in the azure AD and why all the machines have the same device id.
Getting the error caa20002 when connect to the machine
Solution:
Resolved by @Eudelio Benitez Gonzalez below steps followed