Keys / Azure OpenAI

AZURE_OPENAI_API_KEY

One of the two keys of your Azure OpenAI resource. Your app sends it to call models deployed on that resource.

Expires
the docs don't say
API
list and regenerate, with the Azure management API

Get it

Create one on portal.azure.com. The steps aren't recorded yet.

Set it

AZURE_OPENAI_API_KEY=...

The OpenAI Python and Node.js SDKs read it in their AzureOpenAI clients when you don't pass a key. In Python, AZURE_OPENAI_AD_TOKEN wins if both are set. Or keep it out of .env with keypin: keypin run -- npm run dev

Replace it

  1. Move every app to key 1, so key 2 is unused. Regenerating a key stops the old value at once.
  2. On the resource's Keys and Endpoint page in the Azure portal, click Regenerate Key 2, then deploy the new key 2.
  3. Check that every app uses key 2, then regenerate key 1 the same way.

Set rotate_every on the key in keypin.toml and a rotated date on its vault item, and keypin status shows when it's due.

Sources, checked 2026-11-16