First, you need to put the VM into a Stopped (Deallocated) state. You can do this by running the following command:
az vm deallocate --resource-group PacktPub --name PacktPubVMCLI
Next, you need to create an NIC by running the following command:
az network nic create --resource-group PacktPub --name AddNICCLI
--vnet-name CLIVNet --subnet S1 --network-security-group CLINSG
After that, you can add the NIC to the VM by running the following command:
az vm nic add --resource-group PacktPub --vm-name PacktPubVMCLI --nics ADDNICCLI
Finally, you can start the VM by running the following command:
az vm start --resource-group PacktPub --name PacktPubVMCLI