Login to VPN via CLI on Windows Using Cisco AnyConnect with DUO MFA

457 Views Asked by At

I currently login to a VPN endpoint using AnyConnect UI:

enter image description here

Ultimately, I am looking to automate this using a C# Program via Windows CLI.

I have looked at many places on SO and have found that the most common way to automatically login to VPN via CLI is to use: vpncli.exe -s < vpn.creds

The problem I'm having is that I'm connecting to an endpoint that also uses DUO MFA. There is an option given by the provider to simply add the string "push" to the duo field which will trigger an MFA "Accept" request on our configured mobile. I feel this method would be preferable over manually typing in the MFA the code Ahead of time into the Duo Passcode field from the Duo App.

However Everytime I run the code sample above using my vpn.creds file it never works:

enter image description here

The format for my vpn.creds file is as follows:

connect <hostname>
<user>
<pass>
push
0

There are 0 best solutions below