I haven't used D3D12 yet, but i guess it will be the same as in D3D11. Meaning you call IUnknown::QueryInterface on your device, command list and command queue.
You need to initially use D3D12GetDebugInterface() to get ID3D12Debug, and then call EnableDebugLayer(). In fact you need to do this before you ever create a device, otherwise things will blow up in spectacular ways. Once you've enabled the debug layer and created your device, you can obtain ID3D12DebugDevice\ID3D12DebugCommandList\ID3D12DebugCommandQueue by using QueryInterface on ID3D12Device\ID3D12CommandList\ID3D12CommandQueue. You can also use QueryInterface to get ID3D12Debug from your ID3D12Device, but only if you first called D3D12GetDebugInterface and called EnableDebugLayer.