Search code examples
c#azure-iot-hubazure-iot-edgetpmazure-iot-dps

Deployment config in edge agent's desired properties is empty


I meet a problem as the title said.

Description:

1.I use the DPS with fTPM , Windows platform.

2.After run Initialize-IoTEdge -dps in powershell , I get the error in EdgeAgent's log:"Deployment config in edge agent's desired properties is empty."

Looking for help and suggestion . Thx!

This is my code to register the device to DPS.

 #region Create a new individualEnrollment config

                rootPage.NotifyUser("\nCreating a new individualEnrollment...", NotifyType.StatusMessage);
                Attestation attestation = new TpmAttestation(TpmEndorsementKey);
                IndividualEnrollment individualEnrollment =
                        new IndividualEnrollment(
                                RegistrationId,
                                attestation);

                // The following parameters are optional. Remove them if you don't need them.
                individualEnrollment.DeviceId = OptionalDeviceId;
                individualEnrollment.ProvisioningStatus = ENABLE;
                individualEnrollment.Capabilities = new DeviceCapabilities { IotEdge = true };

                #endregion

                #region Create the individualEnrollment

                rootPage.NotifyUser("\nAdding new individualEnrollment...", NotifyType.StatusMessage);
                IndividualEnrollment individualEnrollmentResult =
                    await provisioningServiceClient.CreateOrUpdateIndividualEnrollmentAsync(individualEnrollment).ConfigureAwait(false);
                rootPage.NotifyUser("\nIndividualEnrollment created with success.", NotifyType.StatusMessage);
                rootPage.NotifyUser(individualEnrollmentResult.ToString(), NotifyType.StatusMessage);

The log of edge agent module:

2019-07-18 22:56:41.751 -07:00 [INF] - Edge agent connected to IoT Hub via Amqp_Tcp_Only.
2019-07-18 22:56:42.613 -07:00 [INF] - Obtained Edge agent twin from IoTHub with desired properties version 1 and reported properties version 1.
2019-07-18 22:56:42.641 -07:00 [INF] - Deployment config in edge agent's desired properties is empty.
2019-07-18 22:56:42.642 -07:00 [ERR] - Error refreshing edge agent configuration from twin.
Microsoft.Azure.Devices.Edge.Agent.Core.ConfigSources.ConfigEmptyException: This device has an empty configuration for the edge agent. Please set a deployment manifest.
   at Microsoft.Azure.Devices.Edge.Agent.IoTHub.EdgeAgentConnection.UpdateDeploymentConfig() in C:\agent\_work\4\s\edge-agent\src\Microsoft.Azure.Devices.Edge.Agent.IoTHub\EdgeAgentConnection.cs:line 232
   at Microsoft.Azure.Devices.Edge.Agent.IoTHub.EdgeAgentConnection.RefreshTwinAsync() in C:\agent\_work\4\s\edge-agent\src\Microsoft.Azure.Devices.Edge.Agent.IoTHub\EdgeAgentConnection.cs:line 187
2019-07-18 22:56:43.015 -07:00 [INF] - Updated reported properties

Solution

  • In the portal of your IoT Hub , IoT Edge->select your IoT Edge device->set module->next->next->submit.

    Then the edgeAgent will get the desired properties.

    This is probably a new step that I haven't done in previous versions.