I made a custom connector for QuickBooks Online so we can integrate it with Dynamics 365.
I started making the QBO connector using their built in "Sandbox" environment so I could isolate my testing from the production environment. Thus, it is called "QuickBooks Online - Sandbox".
I've since come to find out that if I make a custom connector called "QuickBooks Online - Production" and want to switch my Flows to using it, I basically have to rebuild the Flows where it uses the connector.
Really, really, really poor design decision on the part of Microsoft.
At any rate, I decided the simplest solution is to just use the same connector and when we want to use it for production, change the URL information in the various actions in the custom connectors to point at the production environment... (and cross my fingers this doesn't delete all the information in Flows).
All that being said, it is kind of confusing because I am apparently stuck with the name "QuickBooks Online - Sandbox" and just want to change it to "QuickBooks Online".
Some things are really frustrating on Power Platform, I totally feel your pain.
For the specific case of creating custom connectors (CC) on Sandbox and then migrating them, there are some workaround you can do:
You can now update the env vars for development, edit and test your CC. After you finish testing, you can export the solution and import it again and it should work.
Now, working on your normal solution, you can include the CC and Connection Reference, export and import. The CC will be linked correctly to the one you exported before and you'll not have trouble redoing everything.
*If you try to import a CC for the first time with a Connection Reference, it will fail, you always need to import JUST the CC and when it's already in the new environment, you can import a solution with a Connection Reference
I found the hard way recently and I can see your frustrations. You can't add the custom connector as part of your solution and deploy it. Believe one of the reason could be is the endpoint can be different for each environments of your custom API.
Following are the steps I used to deploy my custom connector.
1. Created my customer connector under my dev environment.
2. Once the build is finished and tested then click the download
3. Change your environment from dev to test or production. Click custom connector > New custom connector > Import an OpenAPi file.
4. This does import the settings from your Dev environment. Review each settings, update the client id & secret key if using OAuth 2.0
Not the best way but it saves quite a lot of time to enter all the details again.
Thanks