If the answer from Arlene D. did not help, there is a known bug with the latest Windows Updates that can cause symptoms like this.
KB5079420 KB5079473 KB5084897 - Known issues in this update
After installing this update, you might experience an issue signing into apps with a Microsoft account. Even when the device has a working internet connection, an error might appear during sign in that indicates a lack of internet connection and prevents access to Microsoft services and apps Microsoft is working to release a resolution for this issue in the next few days. Additional information will be shared as soon as it becomes available. Workaround - This issue occurs when the device enters a specific network connectivity state and might resolve on its own. If you encounter this issue, restart the device while keeping it connected to the internet. This should repair the device connectivity state and prevent the issue from occurring.