If it is going to butt up against the wall spec would be to flash it with headwall flashing, minimum of 2" up the wall & 3" on the roof.
You want the flashing to be behind the siding.
And if it’s going to be free standing, you can finish it with a piece of flashing depicted below. Make it about 4 inches on the roof and 3 inches down the backside of the structure. Fasten to the roof and caulk nails.