I have the following code:
DeviceRegistrationResult dpsRegistrationWithEnrollmentGroupResult = await ProvisionDeviceViaEnrollmentGroupAsync(parameters, devicePrimaryKey, deviceSecondaryKey, cancellationToken);
// Create Device Client
var authMethodWithEnrollmentGroup = new DeviceAuthenticationWithRegistrySymmetricKey(dpsRegistrationWithEnrollmentGroupResult.DeviceId, devicePrimaryKey);
var options = new ClientOptions
{
ModelId = modelId,
};
DeviceClient deviceClient = DeviceClient.Create(hostname, authenticationMethod, TransportType.Mqtt, options);
var twin = await deviceClient .GetTwinAsync();
DeviceId = twin.DeviceId;
The device is provisioned but the DeviceId is null.
What do I need to do to get the actual DeviceId?