Azure iot edge blob storage offline

62 Views Asked by At

I am trying to use the Azure iot edge blob storage where the iot edge server might come up and not have internet access and I need the blob storage to still be accessible. The problem I am having is that the blob storage module will not start without internet access. Is there a configuration I need to change or is blob storage not supported? Here is the logs of the module starting:

Starting Azure Blob Storage on IoT Edge, version 1.4.1.0.
Unhandled exception. System.AggregateException: One or more errors occurred. (One or more errors occurred. (Transient network error occurred, please retry.))
 ---> System.AggregateException: One or more errors occurred. (Transient network error occurred, please retry.)
 ---> Microsoft.Azure.Devices.Client.Exceptions.IotHubCommunicationException: Transient network error occurred, please retry.
 ---> System.Net.Sockets.SocketException (104): Connection reset by peer
   at Microsoft.Azure.Devices.Client.Transport.Mqtt.MqttTransportHandler.OpenAsyncInternal(CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.Transport.Mqtt.MqttTransportHandler.OpenAsync(CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.Transport.ProtocolRoutingDelegatingHandler.OpenAsync(CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler.<>c__DisplayClass22_0.<<ExecuteWithErrorHandlingAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler.ExecuteWithErrorHandlingAsync[T](Func`1 asyncOperation)
   --- End of inner exception stack trace ---
   at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler.ExecuteWithErrorHandlingAsync[T](Func`1 asyncOperation)
   at Microsoft.Azure.Devices.Client.Transport.RetryDelegatingHandler.<>c__DisplayClass32_0.<<OpenAsyncInternal>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.Azure.Devices.Client.Transport.RetryDelegatingHandler.EnsureOpenedAsync(CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.Transport.RetryDelegatingHandler.<>c__DisplayClass23_0.<<EnableTwinPatchAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.Azure.Devices.Client.Transport.RetryDelegatingHandler.EnableTwinPatchAsync(CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.InternalClient.SetDesiredPropertyUpdateCallbackAsync(DesiredPropertyUpdateCallback callback, Object userContext, CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.InternalClient.SetDesiredPropertyUpdateCallbackAsync(DesiredPropertyUpdateCallback callback, Object userContext)
   at Microsoft.Azure.Devices.BlobStorage.IoT.ModuleTwinConfigurationProvider.Initialize()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at Microsoft.Azure.Devices.BlobStorage.IoT.ModuleTwinConfigurationProvider..ctor(ModuleClient iotModuleClient)
   at Microsoft.Azure.Devices.BlobStorage.IoT.ModuleTwinConfigurationSource.Build(IConfigurationBuilder builder)
   at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
   at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
   at Microsoft.Extensions.Hosting.HostBuilder.Build()
   at Microsoft.AzureStack.Services.Storage.FrontEnd.Program.BuildServices(String[] args)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at Microsoft.AzureStack.Services.Storage.FrontEnd.Program.Main(String[] args)

It does work correctly if I give it internet to startup then take it offline but it does not work if it does not have internet to start up.

Also noticing the following in the edge agent logs:

 Module 'azureblobstorageoniotedge' scheduled to restart after 05m:00s (02m:29s left). Empty edge agent config was received.
 Attempting to read config from backup(/tmp/edgeAgent/backup.json) instead
1

There are 1 best solutions below

0
Sampath On

IoT Edge devices automatically have offline capabilities enabled. When an IoT Edge device goes into offline mode, the IoT Edge hub takes on three roles:

  • Storing any messages that would go upstream and saving them until the device reconnects.
  • Acting on behalf of IoT Hub to authenticate modules and downstream devices, so they can continue to operate.
  • Enabling communication between downstream devices that normally would go through IoT Hub.
  • Use this DOC to deploy the Azure Blob Storage on IoT Edge module to your device.
  • Store data at the edge with Azure Blob Storage on IoT Edge.
  • Refer to this link for Azure Blob Storage on IoT Edge offline.

deployment.template.json:

    "azureblobstorageoniotedge": {
            "version": "1.0",
            "type": "docker",
            "status": "running",
            "restartPolicy": "always",
            "settings": {
              "image": "mcr.microsoft.com/azure-blob-storage:latest",
              "createOptions": {
                "Env": [
                  "LOCAL_STORAGE_ACCOUNT_NAME=your_storage_account_name",
                  "LOCAL_STORAGE_ACCOUNT_KEY=your_storage_account_key"
                ],
                "HostConfig": {
                  "Binds": [
                    "blobvolume:/blobroot"
                  ],
                  "PortBindings": {
                    "11002/tcp": [
                      {
                        "HostPort": "11002"
                      }
                    ]
                  }
                }
              }
            }
          },
          "blobWriterModule": {
            "version": "1.0",
            "type": "docker",
            "status": "running",
            "restartPolicy": "always",
            "settings": {
              "image": "${MODULES.blobWriterModule}",
              "createOptions": {
                "Env": [
                  "storageconnectionstring=DefaultEndpointsProtocol=DefaultEndpointsProtocol=https;AccountName=your_storage_account_name;AccountKey=your_storage_account_key;EndpointSuffix=core.windows.net",
                  "storageContainername=samplecontainer"
                ]
              }
            }
          }
        }
      }
    }


enter image description here

enter image description here

enter image description here