Type IV secretion systems (T4SSs) are complex machines used by bacteria to deliver protein and DNA complexes into target host cells1-5. Conserved ATPases are essential for T4SS function, but how they coordinate their activities to promote substrate transfer remains poorly understood. Here, we show that the DotB ATPase associates with the Dot-Icm T4SS at the Legionella cell pole through interactions with the DotO ATPase. The structure of the Dot-Icm apparatus was solved in situ by cryo-electron tomography at 3.5 nm resolution and the cytoplasmic complex was solved at 3.0 nm resolution. These structures revealed a cell envelope-spanning channel that connects to the cytoplasmic complex. Further analysis revealed a hexameric assembly of DotO dimers associated with the inner membrane complex, and a DotB hexamer associated with the base of this cytoplasmic complex. The assembly of a DotB-DotO energy complex creates a cytoplasmic channel that directs the translocation of substrates through the T4SS. These data define distinct stages in Dot-Icm machine biogenesis, advance our understanding of channel activation, and identify an envelope-spanning T4SS channel.