Keys / Microsoft Entra ID
AZURE_CLIENT_SECRET
A client secret of a Microsoft Entra app registration. Your app signs in as that app with it, AZURE_CLIENT_ID and AZURE_TENANT_ID.
- Expires
- you choose, up to 24 months
- API
- add and remove, with Microsoft Graph
Get it
Create one on entra.microsoft.com. The steps aren't recorded yet.
Set it
AZURE_CLIENT_SECRET=...
EnvironmentCredential and DefaultAzureCredential in the Azure Identity libraries for Python, JavaScript, Go and Java read it, with AZURE_CLIENT_ID and AZURE_TENANT_ID. Or keep it out of .env with keypin: keypin run -- npm run dev
Replace it
- Microsoft recommends a managed identity, a certificate or a federated credential over a client secret where you can use one.
- In App registrations, open the app, then Certificates & secrets > Client secrets > New client secret. Microsoft recommends an expiry under 12 months. Copy the value; it's shown once. With the Azure CLI, run
az ad app credential reset --id <app-id> --append; without--appendit overwrites the app's existing credentials. - Deploy the new value everywhere that reads
AZURE_CLIENT_SECRET. - Check that nothing still uses the old secret, then delete it.
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
- Microsoft Entra: Add and manage application credentials
- Microsoft Entra: Security best practices for app registrations
- Microsoft Entra: Migrate applications away from secret-based authentication
- Microsoft Graph: application addPassword
- Microsoft Graph: application removePassword
- Azure CLI: az ad app credential
- azure-identity (Python): reads AZURE_CLIENT_SECRET
- @azure/identity (JavaScript): reads AZURE_CLIENT_SECRET
- azidentity (Go): reads AZURE_CLIENT_SECRET
- azure-identity (Java): reads AZURE_CLIENT_SECRET