There are JSON files on your ArcGIS Server. On MY server it is in C:\arcgisserver\config-store\ and there is a security\ folder and name of the file is security-config.json
The file has the URLS and secrets embedded in it so I won't paste the whole thing in here but it's readable.
I note there is a LOCK file which means someone (WA or Server?) has it open right now, so you'd need to shut everything down if you were going to edit it. Otherwise chances are either it will refuse to write changes to the file or you will find that when the service shuts down it rewrites the file wiping out your changes.
If you edit this file (may Esri forgive you) then it might just break unless you are doing something really minor like updating a server name because it changed in DNS. My guess is that it might not work because the secret won't work anymore but I am a daring soul and would just try it anyway. You may be more cautitous.
In my case all I had to know was which of the machine's names I had used. We have internal names and public names. I could not tell what was needed and it killed my upgrade because Esri support is closed on weekends.
I think this is the most stupid thing, they should fill in the form FOR you on upgrades, not make you guess and guess and not tell you what you are doing wrong (The message is basically "ERROR: you entered the URL OR the username OR the password wrong OR maybe all three you keep guessing good luck.") This killed a SATURDAY upgrade for me because I could not get past that stage and I had to back out and send in a support request the following Monday. So I am still peeved. You should only have to know the PASSWORD. On the second try I knew I had the correct URL and I was able to work out the admin username and password. Hopefully this message saves you a couple Saturdays for something like gardening or bicycling.
The Portal configurations appear to be stored in a secret PostgreSQL server, which seems like a monumentally bad engineering decision but no one asked my opinion on that. 😉