I am trying steps from this tutorial - https://github.com/Azure-Samples/openai/blob/cf0f19f36a30925e3891137b0bc2539e25687cac/Basic_Samples/AAD_Integration/setup_aad.md
I tried to run the completion from Azure CLI
. I notice that if I use authorisation
header in curl
api then the call fails. However, if I use api-key
header then the call works. What is the difference?
with authorisation
header
PS /home/manu> curl ${OPENAI_API_BASE}/openai/deployments/try-davinci/completions?api-version=2022-12-01 -H "Content-Type: application/json" -H "Authorization: Bearer $accessToken" -d '{ "prompt": "Tell me a funny story." }'
{"error":{"code":"PermissionDenied","message": "Principal does not have access to API/Operation."}}
with api-key
header
PS /home/manu> curl https://aoai-try-mc.openai.azure.com/openai/deployments/try-davinci/completions?api-version=2022-12-01 -H "Content-Type:application/json" -H "api-key:keygoeshere" -d '{"prompt":"Tell me a funny story"}'
{"id":"cmpl-7MWgCWwibSp1nToOLeDfW7VkJvY8T","object":"text_completion","created":1685603192,"model":"text-davinci-003","choices":[{"text":"\n\nOnce, a chicken and a pig were talking and the chicken said,","index":0,"finish_reason":"length","logprobs":null}],"usage":{"completion_tokens":16,"prompt_tokens":5,"total_tokens":21}}