Why would it have to be a one-liner if it's in a script?
I get it if you are doing this interactively in the PS consolehost.
A dynamicParameter can be a dataset from whatever collection you pass to it.
Secondly, this...
Get-azurermsubscription | set-azuremcontext; get-azurermvirtualnetwork
… is two completely separate commands. Semi colon, does not make it a one-line, just separate command on the same line (code break). You cannot pass results from the left side of the semi colon to anything on the right.
The above is really just this...
Get-azurermsubscription | set-azuremcontext
get-azurermvirtualnetwork
You need to find as matching property or value between these two to get what you are after, just as you would with non-Azure cmdlet table / data matches.
Get-azurermsubscription | %{get-azurermvirtualnetwork}