Hello @Jignesh Vala ,
The IoT Hub is accessible using the CLI using the AZ keyword.
I expect you have installed it already.
For IoT, there is a separate extension:
az extension add --name azure-iot
I also recommend checking if the CLI AZ command needs an update:
az upgrade
I used the 'interactive' version (which is still in preview):
az interactive
This generated for my test (the tool let me leave out 'az'):
az iot hub device-identity list --top -1 --edge-enabled true --hub-name edgedemo-ih
This gave me a JSON representation of all known (edge) devices, not limited in length:
From here, you can parse the JSON to get the count.
An alternative is the query language:
az iot hub query --hub-name edgedemo-ih --output json --query-command 'select * from devices'
this gives you more control over the output and returns: