Vertical pipes would be fastened into a flange at bottom. Top rail can be fastened into a flange attached to the wall with an angled block behind it. I'm not sure how to transition between vertical and sloped.
we have two such rails at our house. My husband made them both. As Ken says two flanges on each railing one at top, one at bottom (one vertical, one horizontal) 3 pieces of pipe fastened with appropriate connectors. Railing shows better on 4th of July pic.