You can't leave a Windows domain in the ProxySG appliance Management Console because the Leave button is grayed out.
To resolve the issue:
ProxySG#config t
ProxySG#(config)security windows-domain
ProxySG#(config security windows-domains)leave mydomain
% Domain alias "mydomain" is referenced by another configuration - check MAPI Proxy or IWA Direct Realm.
Exchange domain name alias:
ProxySG#config t
ProxySG#(config)mapi
ProxySG#(config mapi)
view
ProxySG#config t
ProxySG#(config)mapi
ProxySG#(config mapi)
no exchange-domain