-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
Hi all,
the setup for authentication seems buggy or the instructions are in the wrong order? Maybe a few of you run into it as well. So that is why I have documented it. If I rerun all commands a few times then it finally works. But here is how the steps are in detail:
First I initialize a project, set environment name
azd init -t azure-search-openai-demothen I login
azd auth login-
Enable authentication for the app Run the following command to show the login UI and use Entra authentication by default:
azd env set AZURE_USE_AUTHENTICATION true
-
Enable access control on your search index
- If the index does not exist yet:
Run theprepdocsscript.
./scripts/prepdocs.ps1
- If the index does not exist yet:
Now it shows a Key error:
[21:31:03] INFO Loading azd env from C:\Users\DELL\.azure\bf-deepv1\.env, which load_azd_env.py:28
may override existing environment variables
INFO Connecting to Azure services using the azd credential for home tenant prepdocs.py:215
Traceback (most recent call last):
File "C:\Users\DELL\app\backend\prepdocs.py", line 228, in <module>
OPENAI_HOST = OpenAIHost(os.environ["OPENAI_HOST"])
~~~~~~~~~~^^^^^^^^^^^^^^^
File "<frozen os>", line 714, in __getitem__
KeyError: 'OPENAI_HOST'
This makes sense, because I haven't set anything regarding the openai key. Now I set my tenant ID, which I get from azure portal under subscriptions:
- Set the authentication tenant ID
Specify the tenant ID associated with authentication by running:
azd env set AZURE_AUTH_TENANT_ID <YOUR-TENANT-ID>Next I run azd up, which also sets my openai key.
azd upNow I am able to run prepdocs. And then I run azd up again
azd up