Using Azure Blob Storage only for local storage

ambharesh venkatraman 61 Reputation points
2021-04-20T04:43:35.037+00:00

Hi,

I want to use azure-blob-storage container to store data in a local directory. I have used the upload_blob from another container for this purpose. The file is getting uploaded to the cloud but not getting stored in the local path. I have given binds, device to cloud upload properties and also changed the permissions for the directory with "chmod 777". After doing all this the file is not getting saved locally.

I want the blob-storage container to upload the blob not my container. What is the better practice to do that.

python function to upload

with blob_service_client.get_blob_client(container=container_name, blob=local_file_name) as upload_client:
    with open(upload_file_path, "rb") as data:
        print("Uploading the file")
        upload_client.upload_blob(data, blob_type="BlockBlob", overwrite=True)
        print("Finished uploading")

Deployment manifest

BINDS-

"HostConfig": {
      "Binds": [
          "/opt/localstorage/blob/:/blobroot"
      ]

Upload properties

    "blobstorage": {
      "properties.desired": {
        "deviceToCloudUploadProperties": {
          "uploadOn": true,
          "uploadOrder": "NewestFirst",
          "cloudStorageConnectionString": "xxxx"
          "storageContainersForUpload": {
            "bloboutput": {
              "target": "bloboutput"
            }
          }
        },
        "deviceAutoDeleteProperties": {
          "deleteOn": false,
          "deleteAfterMinutes": 15
        }

logs-

[2021-04-20 04:23:57.857] [info    ] [tid 1] Info: Successfully loaded {0}: {1}, p0="Nephos.MaskClientIPAddressesInLogs", p1="False"
[2021-04-20 04:23:57.857] [info    ] [tid 1] Info: Loading config Param {0} ({1}) read: {2}, p0="NephosIncludeInternalDetailsInErrorResponses", p1="Include internal details in error responses", p2="true"
[2021-04-20 04:23:57.857] [info    ] [tid 1] Info: Successfully loaded {0}: {1}, p0="NephosIncludeInternalDetailsInErrorResponses", p1="True"
[2021-04-20 04:23:57.857] [info    ] [tid 1] Info: Loading config Param {0} ({1}) read: {2}, p0="StampName", p1="Stamp Name", p2="Default Stamp"
[2021-04-20 04:23:57.924] [info    ] [tid 1] Microsoft.AzureStack.Services.Storage.EntryPoint.BlobService: BlobService - StartAsync completed
[2021-04-20 04:23:57.925] [info    ] [tid 1] Microsoft.Azure.Devices.BlobStorage.Tiering.BlobTieringService: Starting service...
[2021-04-20 04:23:57.937] [info    ] [tid 1] [BlobInterface.cc:1494] [ListBlobsInOrder] ListBlobsInOrder received. Container:bloboutput BlobNameStart:null MaxBlobNames:1 OrderType:1 Flags:1
[2021-04-20 04:23:57.937] [error   ] [tid 1] [MetaStore.cc:1953] [ListBlobsInOrder] Container not found. Name:bloboutput
Azure Internet of Things
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
{count} votes

1 answer

Sort by: Most helpful
  1. QuantumCache 20,676 Reputation points Moderator
    2021-04-26T18:06:45.89+00:00

    Hello @ambharesh venkatraman Please have a look at the below sections to make changes to the Upload properties: Please follow the instructions in the below reference documents.

    deviceToCloudUploadProperties

    How to use Azure Blob Storage on IoT Edge

    91352-image.png

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.