Various Linux (Debian buster to bullseye) and MacOS from Catalina to Ventura.
I am attempting automate a few deployment things I am doing and to my surprise I did not find an easy way to find my own tailnet name. I looked at the various tail scale subcommands but could not find anything. I am I looking at the wrong places? Do I need to use the API to find out?
If you add the --json flag to the tailscale status command, you’ll get back a verbose JSON where you can find your tailname under MagicDNSSuffix. (It pops up in multiple places throughout the JSON though.)
I don’t know where you would have to look if you didn’t use MagicDNS though.
EDIT: If you have jq installed, you can use this command to extract the MagicDNS name: tailscale status --json | jq -j '.MagicDNSSuffix' (The -j removes the double quotes from the returned value.)