Unable to remove FortiManager from a FortiGate

Unable to remove FortiManager from a FortiGate
fortinet-solutions

In order to resolve a failed relationship between a FortiGate and FortiManager we needed to remove the FortiGate.  In FortiManager this worked fine, however in FortiGate the relationship still persisted (under Security Fabric -> Settings -> Central Management).

If we attempted to disable the Central Management toggle we received the following error:

Failed to save FortiManager settings

In the CLI if we attempted to remove the FMG IP address we received the following error:

Please unregister-device from FortiManager first.

The resolution was to change the FMG IP address to 0.0.0.0 and exit the Central Management config.  Then after re-entering the Central Management section again the FMG IP could be removed.

Please unregister-device from FortiManager first.object set operator error, -582 discard the settingCommand fail. Return code -582