azure-search-openai-demo
azure-search-openai-demo copied to clipboard
Authorization failed
Requirement already satisfied: charset-normalizer<4,>=2 in ./scripts/.venv/lib/python3.9/site-packages (from requests>=2.18.4->azure-core<2.0.0,>=1.23.0->azure-ai-formrecognizer==3.2.1->-r ./scripts/requirements.txt (line 4)) (3.1.0)
Requirement already satisfied: idna<4,>=2.5 in ./scripts/.venv/lib/python3.9/site-packages (from requests>=2.18.4->azure-core<2.0.0,>=1.23.0->azure-ai-formrecognizer==3.2.1->-r ./scripts/requirements.txt (line 4)) (3.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./scripts/.venv/lib/python3.9/site-packages (from requests>=2.18.4->azure-core<2.0.0,>=1.23.0->azure-ai-formrecognizer==3.2.1->-r ./scripts/requirements.txt (line 4)) (1.26.15)
Requirement already satisfied: oauthlib>=3.0.0 in ./scripts/.venv/lib/python3.9/site-packages (from requests-oauthlib>=0.5.0->msrest>=0.6.21->azure-ai-formrecognizer==3.2.1->-r ./scripts/requirements.txt (line 4)) (3.2.2)
Running "prepdocs.py"
Ensuring search index gptkbindex exists
Traceback (most recent call last):
File "/workspaces/azure-search-openai-demo/./scripts/prepdocs.py", line 299, in
Please provide us with the following information:
This issue is for a: (mark with an x)
- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)
Minimal steps to reproduce
Any log messages given by the failure
Expected/desired behavior
OS and Version?
Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)
Versions
Mention any other details that might be useful
Thanks! We'll be in touch soon.
I'm seeing the exact same issue. I'm using WSL 2 on Windows 11 Enterprise. I followed all the instructions exactly, except I had to use "azd login --use-device-code" instead of just "azd login". I didn't set any of the environment variables to use existing resources.
same issue for me as well: File "/workspaces/azure-search-openai-demo/MIPGPT/scripts/.venv/lib/python3.9/site-packages/azure/search/documents/indexes/_generated/operations/_indexes_operations.py", line 520, in get_next raise HttpResponseError(response=response, model=error) azure.core.exceptions.HttpResponseError: () Authorization failed. Code: Message: Authorization failed.
This often happens when the previous runs of "azd up" don't run to completion, since one of the last steps is to add roles for the currently logged-in user so the account can access the storage account, search service, etc. Did you try adding your self as blob contributor (in the storage account) and search contributor (in the search service)?
that did it for me, thanks @pablocastro
That didn't work for me :( As far as I can tell, my user has blob contributor permissions in the storage account, and search countributor permissions in the search service. I get the error while doing "azd up". Here's the full stack for the error I get:
Running "prepdocs.py"
Ensuring search index gptkbindex exists
Traceback (most recent call last):
File "/home/bstollnitz/git/azure-search-openai-demo/./scripts/prepdocs.py", line 299, in
ERROR: failed running post hooks: 'postprovision' hook failed with exit code: '1', Path: './scripts/prepdocs.sh'. : exit status 1
I also tried to delete the resource group and start fresh, just in case something was corrupt from previous attempts, and I get the same error.
I am also running into the same error. Many attempts, I am not sure what else I need to do.
My solution was to get the credentials from https://portal.azure.com/ add them to the .env file that was created during the deployment and adjust scripts/prepdocs.sh#L21 so the additional variables get passed. You need to do that for Storage, Search and Formrecognizer.
This issue is fixed on the new azd version.
You can try from a new empty folder and you should not have this issue anymore.
And to fix an existing project, you go to the .env file from .azure/<env-name-folder>/.env and delete the AZURE_PRINCIPAL_ID entry. Then, the next time you run azd up, the value will be populated again correctly.
for me, added me Search Service Contributor as role in the search service. and then run azd up again and it worked.
Same here. I have full admin permission of my own demo subscription. I can see the stack trace error when the script is executing command: azd auth token --output json --scope https://search.azure.com/.default --tenant-id {tenant-id}. When I execute this command using same venv environment it returns without error. I am not sure why it fails in the script.
Same here. I have full admin permission of my own demo subscription. I can see the stack trace error when the script is executing command:
azd auth token --output json --scope https://search.azure.com/.default --tenant-id {tenant-id}. When I execute this command using same venv environment it returns without error. I am not sure why it fails in the script.
Resolved by forcing the environment proxy and recreate entire project using a different name.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this issue will be closed.