Hi,
Are you using a Lenovo device? If so, check whether Zero Touch Lock is enabled, as it has been known to cause this issue on Lenovo devices. If it is a Lenovo, you can either download the Lenovo Vantage app from the Microsoft Store or follow the instructions on the page below to disable it.
https://windowsreport.com/lenovo-vantage-zero-touch-lock/
Disclaimer: This is a non-Microsoft site. The information seems reliable, but be careful with ads. Research any product before downloading.