How do I use Azure AI Foundry endpoints and avoid permission errors
I am new to Azure and I am trying to get the following tutorial working.
I have tried following the tutorial to provision with azd, I have even used a dev container, github codespaces and manually tried to make the required environmental variables.
Whenever I try to run the tests which check for a connection to AI foundry endpoints with ! python -m pytest --rootdir=infra/tests/
I get the permission errors openai.AuthenticationError: Error code: 401 - {'error': {'code': 'PermissionDenied', 'message': 'Principal does not have access to API/Operation.'}}
. I did some googling and it said to do an app registration and pass the AZURE_CLIENT_ID into the .env file and then add the Microsoft Cognitive services "user_impersonation" permission. however I tried this and it still did nothing.
To reiterate this happens even using azd and setting up manual infrastructure so I figure either the code is broken/doesn't explain setup well enough (unlikely), there is something wrong with my Azure account or I am missing something.
Please let me know if anyone knows how to fix this or if you need any further information. Cheers.
Full error: error_code.txt