I fitted a Westfalia detachable towbar to my A5 a couple of years ago. Fairly easy to fit, and I would imagine an A4 is a similar process. If you are happy to remove the rear bumper then it isn’t too hard. The Westfalia witing loom should plug straight into your A4, if not then it takes an hour or so to wire. My A5 wasn’t pre-wired for a towbar but instructions with the Westfalia loom made it fairly easy.
However you wire it you will need to programme the ecu to see the towbar. I have the VAG-COM lead and software so did it myself. Otherwise it is a case of visiting a dealer or finding someone with a lead as mentioned above.
For the A5 Audi sell a neat holder for the detachable part of the towbar, it fits next to the spare wheel. Worth buying if you can get one for the A4.