Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for interactive Entra ID authentication to chat_azure().
This commit adds support for another major Azure authentication approach: the OAuth authorization code flow, as used by the Azure CLI. This is a good choice for authentiation during development on desktop, and Microsoft recommends it for Azure OpenAI because it doesn't require storing sensitive long-lived secrets like API keys. All of this is pretty stock httr2 OAuth stuff, despite the fact that Entra ID has its own... idiosyncrasies. I also went out of the way to add a really specific error message for what I believe to be a common source of problems: misconfiguration of Azure's RBAC. It looks as follows: Error in `req_perform_connection()` at elmer/R/httr2.R:36:3: ! HTTP 401 Unauthorized. • PermissionDenied: Principal does not have access to API/Operation. ℹ Your user or service principal likely needs one of the following roles: Cognitive Services OpenAI User, Cognitive Services OpenAI Contributor, or Cognitive Services Contributor. I haven't added any unit tests (I don't know how to do so for this kind of interactive OAuth flow), but at least the help documentation has been updated. Signed-off-by: Aaron Jacobs <aaron.jacobs@posit.co>
- Loading branch information