IoTEdge local blob storage not accessible

Chris Clague 36 Reputation points
2020-12-28T12:02:07.437+00:00

Hi - following these instructions how-to-store-data-blob I am trying to set up blob storage on a Raspberry Pi 3B (arm32v7) device running Raspbian GNU/Linux 10 (buster).

I have the storage module up and running and using Azure Storage Explorer version 1.10 (seems to be only version that works with this?) - I can connect, create a container and demonstrate the upload/auto delete functionality ok. The BLOB_CONNECTION_STRING below matches that used in the Azure Storage Explorer.

Using python (3.7.3) I am trying to write to the local storage however and it doesn't appear to work.

Firstly, using the Azure storage 2.1.0 SDK:

import os  
from azure.storage.blob import BlockBlobService  
  
BLOB_CONNECTION_STRING = 'DefaultEndpointsProtocol=http;BlobEndPoint=http://<ip address>:11002/<account name>;AccountName=<account name>;AccountKey=<account key>;'  
container = 'iot-timing-upload'  
  
try:  
    bbs = BlockBlobService(connection_string=BLOB_CONNECTION_STRING, endpoint_suffix='',custom_domain='')  
except Exception as err:  
    print(err)  
    raise  
  
local_path='/Users/chris/racehub/utils'  
blob_file_name = 'anon_html.sh'  
full_path='/Users/chris/racehub/utils/anon_html.sh'  
  
try:  
    bbs.create_blob_from_path(  
        container_name=container, blob_name= blob_file_name, file_path=full_path  
    )  
except Exception as err:  
    print(err)  

This gives the following error on create_blob_from_path:

Client-Request-ID=8b9cfd14-48fe-11eb-a3e4-38c9862ca7cf Retry policy did not allow for a retry: , HTTP status code=Unknown, Exception=HTTPConnectionPool(host='<account name>.blob.core.windows.net', port=80): Max retries exceeded with url: /iot-timing-upload/anon_html.sh (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x106e81a90>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known')).  
HTTPConnectionPool(host='<account name>.blob.core.windows.net', port=80): Max retries exceeded with url: /iot-timing-upload/anon_html.sh (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x106e81a90>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))  

I don't really understand why it's looking at blob.core.windows.net as the endpoint suffix is set to '', or why it's looking at port 80.

I also tried using azure-storage-blob 12.6.0:

import os  
from azure.storage.blob import BlobServiceClient  
  
BLOB_CONNECTION_STRING = 'DefaultEndpointsProtocol=http;BlobEndPoint=http://<ip address>:11002/<account name>;AccountName=<account name>;AccountKey=<account key>;'  
  
try:  
    blob_service_client = BlobServiceClient.from_connection_string(BLOB_CONNECTION_STRING)  
except Exception as err:  
    print(err)  
    raise  
  
container = 'iot-timing-upload'  
blob_file_name = 'anon_html.sh'  
  
try:  
    output_file = blob_service_client.get_blob_client(container = container, blob = blob_file_name)  
except Exception as err:  
    print(err)  
    raise  
  
full_path='/Users/chris/racehub/utils/anon_html.sh'  
  
try:  
    with open(full_path, "rb") as data:  
        output_file.upload_blob(data)  
except Exception as err:  
    print(err)  
    raise  
  

Which gave the following error:

Traceback (most recent call last):  
  File "/Users/chris/Library/Python/3.7/lib/python/site-packages/urllib3/connection.py", line 159, in _new_conn  
    (self._dns_host, self.port), self.timeout, **extra_kw)  
  File "/Users/chris/Library/Python/3.7/lib/python/site-packages/urllib3/util/connection.py", line 80, in create_connection  
    raise err  
  File "/Users/chris/Library/Python/3.7/lib/python/site-packages/urllib3/util/connection.py", line 70, in create_connection  
    sock.connect(sa)  
TimeoutError: [Errno 60] Operation timed out  

Please could someone advise where I'm going wrong.
Thanks

Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
576 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,919 questions
{count} votes

Accepted answer
  1. António Sérgio Azevedo 7,671 Reputation points Microsoft Employee
    2020-12-30T12:09:39.06+00:00

    @Chris Clague can you double check the connection string you are using on line 4? I see you posted the code as follows:

    BLOB_CONNECTION_STRING = 'DefaultEndpointsProtocol=http;BlobEndPoint=http://<ip address>:11002/<account name>;AccountName=<account name>;AccountKey=<account key>;'  
    

    I would expect it to be like this:

    BLOB_CONNECTION_STRING = 'DefaultEndpointsProtocol=http;AccountName=<your storage account name>;AccountKey=<your storage account key>;BlobEndpoint=http://127.0.0.1:11002/<your storage account name>;'  
    

    Note that in step 3 of the tutorial you defined the <your storage account name> and <your storage account key>

    Thanks.


0 additional answers

Sort by: Most helpful

Your answer

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