Hi,
You will need to get all VNETs to a variable and do a for each loop and iterate the below command to get the connected devices in each subnet
$result=Get-AzVirtualNetwork -Name 'xxxx' -ResourceGroupName 'xxxx' -ExpandResource 'subnets/ipConfigurations'
$count = $result.Subnets[0].IpConfigurations
$count.Count