Can you please check if there are any CORS policies set on the storage account you are trying to access?
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi Team,
I've written a Azure function in Python using VCC. I'm able to deploy and run the program in Azure portal. The problem I'm facing is to read the blob/and its content. I've used the http template of Azure function.
I'm using below code to read the content,
containerName = "test1"
conn_str = ("BlobEndpoint=https://mydev.blob.core.windows.net/sandbox/test1/random?sp=r&st=2021-10-26T12:36:21Z&se=2021-10-26T20:36:21Z&spr=https&sv=2020-08-04&sr=b&sig=M1WCxkqcHdzRaFjkJOZmbU2%2Bj9yhQu416%2FkXaEYBCm0%3D")
blob_service_client = BlobServiceClient.from_connection_string(conn_str)
container_client = blob_service_client.get_container_client(containerName)
blob_client=container_client.get_blob_client("random")
stream_loader = blob_client.download_blob()
filereader = json.loads(stream_loader.readall)
a_file = open("fileReader.json","w")
a_file = json.dump(filereader,a_file)
with open("fileReader.json", 'r',encoding='utf-8-sig') as f:
data = json.load(f)
blob_list = container_client.list_blobs()
for blob in blob_list:
print("\t" + blob.name)
with open("fileReader.json", 'r',encoding='utf-8-sig') as f:
data = json.load(f)
The connection string I'm using above is created using "Generate SAS" option. Please correct if this is not the right approach.
Also when I run this I get below error,
2021-10-26T12:40:05Z [Information] CORS policy execution failed.
2021-10-26T12:40:05Z [Information] Request origin https://functions.azure.com does not have permission to access the resource.
Could you please help me in getting the things right.
Thanks,
Raja
Can you please check if there are any CORS policies set on the storage account you are trying to access?