0

Below is the code I am using to access the files in my storage account but I get below error . Is anyone error what wrong am I doing here. The key passed here is correct and so is the container and folder name. The error is received at line .parallellize([blob.name for blob....

AzureHttpError: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. ErrorCode: AuthenticationFailed

    import re
    import json
    %pip install azure
    import azure
    from azure.storage.blob import AppendBlobService
    abs = AppendBlobService(account_name='azdevstoreforlogs', account_key="?sv=2021-06-08&ss=bfqt&srt=sco&sp=rwfx&se=2022-06-14T15:48:24Z&st=2022-06-14T07:48:24Z&spr=https&sig=uPA%3D")
    base_path = 'resourceId=/SUBSCRIPTIONS/531subs IDD0-6C3AEB/RESOURCEGROUPS/AZURE-DEV/PROVIDERS/MICROSOFT.CONTAINERSERVICE/MANAGEDCLUSTERS/AZURE-DEV/y=2022/m=05/d=23/h=13/m=00/PT1H.json'        

    spark.sparkContext \
         .parallelize([blob.name for blob in abs.list_blobs('insights-logs-kube-audit', prefix=base_path) if re.match(filter, blob.name)]) \
         .map(lambda blob_name: abs.get_blob_to_bytes('insights-logs-kube-audit', blob_name).content.decode('utf-8').splitlines()) \
         .flatMap(lambda lines: [json.loads(l) for l in lines]) \
         .collect()
ZZZSharePoint
  • 1,163
  • 1
  • 19
  • 54

1 Answers1

0

Error - AzureHttpError: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. ErrorCode: AuthenticationFailed

Above error may cause because of Firewall and virtual networks settings. Make sure Public network access is set to Enabled from all networks or Enabled from selected virtual networks and IP addresses.

enter image description here

If you select the second option i.e. Enabled from selected virtual networks and IP addresses, you need to configure IP address, resource type and Instance name.

enter image description here

You can also refer this similar issue

Abhishek K
  • 3,047
  • 1
  • 6
  • 19