Skip to main content

Allow PAC over the Firewall

By Betim Beja ·

Are you trying to use the PAC cli or the Power Platform Tools vscode extension from your firewalled environment without success?

If you see the following error, then it might be a sign that the PAC cli cannot use your company's proxy server and cannot securely and safely communicate with the microsoft online services.

pac auth create authenticates, then fails with a non-recoverable System.Net.Http.HttpRequestException

What you can try in this scenario is to configure the PAC cli to use a specific proxy or the default proxy from your system. You need to open the app.config of pac cli. You can use the following Powershell command to locate the pac.exe.config used by the vscode extension on a windows machine.

powershell
code "$((Get-Command pac).Source).config"

Your pac.exe.config will open in vscode for editing.

pac.exe.config open in VS Code with a system.net defaultProxy section pointing to a company proxy address
config
<system.net>
    <defaultProxy enabled="true" useDefaultCredentials="true">
      <proxy autoDetect="false" bypassonlocal="true"
        proxyaddress="http://proxy.my.company:8081" />
    </defaultProxy>
</system.net>

If you don't want a specific proxy then the following uses the default system proxy

default.config
<system.net>
    <defaultProxy enabled="true" useDefaultCredentials="true">
    </defaultProxy>
</system.net>

The author of this post (Betim Beja) can help you deliver your projects with confidence. If you think you could benefit from his services just contact him.