MAAS documentation on using CLI

So I am trying to follow some guides from Canonical/Ubuntu about MAAS, Juju, Openstack. One of the examples is https://maas.io/docs/how-to-use-the-maas-cli Here in the instructions it says:

sudo maas apikey --username=admin > api-key-file
maas login admin http://192.168.43.251:5240/MAAS/api/2.0/ < api-key-file

When I try this with 3.2.2 or 3.2.4, it will:
a.) not accept the redirect from the file, but will prompt me with:

provsvc@lab-ubnt-maas-01-a:~$ maas login admin http://10.241.96.21:5240/MAAS/api/2.0/ < api-key-file
API key (leave empty for anonymous access):

b.) When I paste the api key in, I get:

usage: maas [-h] COMMAND ...

optional arguments:
  -h, --help      show this help message and exit
...
[Errno 104] Connection reset by peer

When I try to run

juju bootstrap --bootstrap-series=focal --constraints tags=juju maas-one maas-controller

I also get

ERROR Forbidden

I am pretty sure the Juju problem is the same problem the above maas login has

How can I further debug this?

ow! that’s a problem i’ve had from time to time with those instructions. gimme a few days and i’ll see if i can figure it out; this bugs me.

@uzimmermann, so the (really old) instructions are broken. it works if you do maas $PROFILE $MAAS_URL $(head -1 api-key-file) – i’m gonna change the doc now.

I assume this is in relation to access from CLI. But how can I debug the Juju part where it gives me an authorization error?

@uzimmermann, sadly, you’ll probably have to ask that in one of the juju forums. if you can’t get any answers there, please let me know.