How do I supply a password to NetworkManager-openconnect automatically?

Solution 1:

You need to keep in mind that if you are editing a config generated by the NetworkManager and any changes via the UI or CLI against the connection will reset and remove the non-default configuration elements. This means if you open the connection through "Manage network connections" or run nmcli commands to update any value, if you look at the config it will probably be missing the secrets.

As per penguinbait's answer you will need to edit the file and save, then restart NetworkManager.

Solution 2:

After adding the lines [vpn-secrets]

Restart network manager

systemctl restart NetworkManager 

Then bring the connection up with nmcli