Thank you for posting in Microsoft Q&A forum.
May we know which step do we get this error? Have we checked the related logs for more details? Such as CMG-<cloud_service_name>-ProxyService_IN_0-CMGSetup.log, CloudMgr.log, CMG-<cloud_service_name>-ProxyService_IN_0-CMGService.log, SMS_Cloud_ProxyConnector.log on the server side.
For more details about CMG troubleshooting:
https://www.systemcenterdudes.com/sccm-cloud-management-gateway-cmg-troubleshooting-tips/
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Add comment".