Use a VPN in Power BI with an External API calling to solve the above difficulties, which arose due to complicated network restrictions, lack of authentication, and connection handling features of Power BI. Some solutions are as follows to address the connectivity issue:
VPN and Firewall Settings: The first thing is to check whether your VPN allows Power BI to access the Internet outside, as some VPNs may disallow access outside the Internet but allow local data or API access. Try whitelisting the API domain in your VPN settings or configuring a split tunneling feature of your VPN to allow Power BI to bypass the VPN restrictions.
Use an On-Premises Data Gateway for the On-Premises API: In instances when the API can only be fully accessed using the VPN, setting up an On-Premises Data Gateway in Power BI may assist. This is because the Power BI Service would connect via the local PC while maintaining the VPN connection behind it.
Check API Access Outside Power BI: Check with either Postman or Python (requests library) and see whether using the VPN makes the API accessible. If not, it might be a function of a failed API access through Power BI while succeeding in other means. In that case, try using Power Query using its M script by calling the API via a Proxy or alternative authenticating means.
Power BI Proxy Setting Configuration: If the VPN itself needs a proxy, it may be necessary to set up the appropriate proxy configurations in Windows or run Power BI Desktop with custom network settings routing requests correctly.