Auto connect the wifi network on Ubuntu 20.04
You need to create a wpa_supplicant-wlan0.conf. So use wpa_passphrase to generate one:
wpa_passphrase MyNetwork SuperSecretPassphrase > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
Enable it so that it runs on boot:
systemctl enable wpa_supplicant@wlan0.conf
Now make a file at /etc/systemd/network/00-wireless-dhcp.network (it can really be named whatever you want):
[Match]
Name=wlan0
[Network]
DHCP=yes
Now ensure that systemd-networkd.service is enabled.
systemctl enable systemd-networkd.service
Reboot, and it should be working.