You need to verify a few things
Use the ping command to test internet connectivity by pinging a public website e.g ping google.com
and Test-NetConnection -ComputerName login.microsoftonline.com -Port 443
Also try to Flush dns. Try ipconfig /flushdns
Aslo check your windows firewall and proxy settings: netsh winhttp show proxy
Verify lastly if you are connected to a VPN
See:
https://learn.microsoft.com/en-us/entra/identity/devices/device-join-plan
You can mark it 'Accept Answer' and 'Upvote' if this helped you
Regards,
Abiola