azure-search-openai-demo icon indicating copy to clipboard operation
azure-search-openai-demo copied to clipboard

why new storage account to enable user upload feature?

Open amirj opened this issue 11 months ago • 6 comments
trafficstars

Hi,

The app is using two blob storage accounts, one of them named as blob_container_client and the other one is user_blob_container_client

Two questions:

  1. Could you help me to understand why we need two blobs and why not using the main blob since we're organising user's content in subfolders?
  2. How to set AZURE_USERSTORAGE_ACCOUNT? --unfortunately I need to set it manually and not via bicep--

amirj avatar Nov 26 '24 14:11 amirj

I tried to set AZURE_USERSTORAGE_ACCOUNT to the same value as AZURE_STORAGE_ACCOUNT but getting the following error:

[2024-11-26 13:07:50 +0000] [62312] [INFO] 127.0.0.1:63543 GET /.auth/me 1.1 404 207 1635
INFO:app:Creating directory for user 289334a6-2dfe-4653-a2f1-0a856a2991cd
ERROR:app:Exception on request POST /upload
Traceback (most recent call last):
  File "/Users/test/chat/.venv/lib/python3.9/site-packages/quart/app.py", line 1403, in handle_request
    return await self.full_dispatch_request(request_context)
  File "/Users/test/chat/.venv/lib/python3.9/site-packages/quart/app.py", line 1441, in full_dispatch_request
    result = await self.handle_user_exception(error)
  File "/Users/test/chat/.venv/lib/python3.9/site-packages/quart/app.py", line 1029, in handle_user_exception
    raise error
  File "/Users/test/chat/.venv/lib/python3.9/site-packages/quart/app.py", line 1439, in full_dispatch_request
    result = await self.dispatch_request(request_context)
  File "/Users/test/chat/.venv/lib/python3.9/site-packages/quart/app.py", line 1535, in dispatch_request
    return await self.ensure_async(handler)(**request_.view_args)  # type: ignore
  File "/Users/test/chat/app/backend/decorators.py", line 53, in auth_handler
    return await route_fn(auth_claims)
  File "/Users/test/chat/app/backend/app.py", line 357, in upload
    await user_directory_client.create_directory()
  File "/Users/test/chat/.venv/lib/python3.9/site-packages/azure/core/tracing/decorator_async.py", line 105, in wrapper_use_tracer
    return await func(*args, **kwargs)
  File "/Users/test/chat/.venv/lib/python3.9/site-packages/azure/storage/filedatalake/aio/_data_lake_directory_client_async.py", line 178, in create_directory
    return await self._create('directory', metadata=metadata, **kwargs)
  File "/Users/test/chat/.venv/lib/python3.9/site-packages/azure/storage/filedatalake/aio/_path_client_async.py", line 216, in _create
    process_storage_error(error)
  File "/Users/test/chat/.venv/lib/python3.9/site-packages/azure/storage/filedatalake/_deserialize.py", line 224, in process_storage_error
    exec("raise error from None")   # pylint: disable=exec-used # nosec
  File "<string>", line 1, in <module>
azure.core.exceptions.HttpResponseError: (AuthorizationFailure) This request is not authorized to perform this operation.

amirj avatar Nov 26 '24 14:11 amirj

@pamelafox If I upgrade my main blob to ADL Gen2, can I use the same blob across the whole project?

amirj avatar Nov 26 '24 15:11 amirj

Have you managed to resolve this, i dont have the upload file completely after deploying, was this the same issue you had?

WannabDad avatar Jan 07 '25 12:01 WannabDad

I can't see managed file upload option in the screen either.

Cortex1-NeuroIQ-AI avatar Feb 19 '25 17:02 Cortex1-NeuroIQ-AI

For the user upload feature, you must enable both user login and user upload. Please make sure you've followed all the steps here: https://github.com/Azure-Samples/azure-search-openai-demo/blob/main/docs/deploy_features.md#enabling-user-document-upload I recommend first enabling user login, confirming that works, and then enabling user upload.

@amirj And sorry, I haven't had a chance to try to use ADSL2 everywhere. They have different SDKs, so I suspect you'd need to modify all the Python code that uses the standard blob SDK and have it use ADLS2 instead.

pamelafox avatar Feb 19 '25 19:02 pamelafox

@pamelafox
I set the USE_USER_UPLOAD="true" and did azd up. Now I can see the user file upload option. Thank you for the quick response.

Cortex1-NeuroIQ-AI avatar Feb 19 '25 22:02 Cortex1-NeuroIQ-AI