Factory Reset an iPhone to Enable MDM
Perform a factory data reset
If you are still having issues with your device, you may need to do a Factory data reset (Master reset). This will reset all settings to their defaults and erase all data stored on iPhone, including your contacts, messages, and music.
1. From the home screen select the Settings app.
Note: iPhone cannot be used while data is being erased. iPhone will instantly and securely erase all data, and then restore settings to their factory defaults. After iPhone reboots, it will display the "Connect to iTunes" screen. If you have backed up your device to iTunes or iCloud, you may be able to restore personal data back to iPhone, if desired. Wi-Fi or a wireless data connection is required to re-activate iPhone after a reset. Learn more from the Apple support articles Back up your iPhone and Erase all content and settings on your iPhone.
2. Select General, then scroll to and select Transfer or Reset iPhone.
3. Select Erase All Content and Settings to reset device, then select Continue.
4. Select Finish Upload Then Erase or Erase Now.
5. Select Erase iPhone to confirm.
Note: If you have a passcode, you will be prompted to enter your passcode to complete the reset. Enter your Apple ID password then select Erase. If you can't update or restore your iPhone with the steps above, for instructions on how to put your device in recovery mode and set it up again, click here.
Apple iPhone 14 - Reset Device - AT&T (att.com)