Hello Dhanavath Vishnu, this is a great scenario everybody should know! thanks for posting this question on this forum!
It is not recommended to associate the same IoT Edge device connection string with multiple virtual machines. As we know that each IoT Edge device should have a unique identity, which includes a unique device ID and device authentication credentials (such as a device connection string).
Coming to the multiple VMs with same device connection String: If you associate the same IoT Edge device connection string with multiple virtual machines, it can cause conflicts and unpredictable behavior. Each virtual machine will try to establish a connection to the IoT hub using the same device identity, which can cause issues with device-to-cloud messaging, device authentication, and other IoT Edge functionality.
Therefore, it is recommended to associate a unique device identity (including a unique device ID and device authentication credentials) with each virtual machine or physical device that hosts an IoT Edge runtime. This will ensure that each IoT Edge device has a unique identity and can function properly within the IoT Edge architecture.
Below is a sample test when 2 devices are simultaneously using the same device connection string to send the telemetry!!!
Apart from sending telemetry issues, we may see the below errors during provisioning and Authentication process.
DeviceIdentityConflict: This error occurs when you try to register a device identity that is already in use by another device. This error may be thrown when you try to register a new device or when you try to connect an existing device to the IoT hub.
DeviceAlreadyExists: This error occurs when you try to create a new device identity with a name that is already in use. This error may be thrown when you try to register a new device using a connection string that is already associated with another device.
Unauthorized: This error occurs when the device authentication credentials (such as the device key or SAS token) provided in the connection string are not valid for the device identity associated with that connection string. This error may be thrown when you try to connect a device using a connection string that is already associated with another device.
If this answers your query, do click Accept Answer and Yes for this answer as helpful. And, if you have any further query do let us know by commenting in the below section.