@auth/azure-tables-adapter
An official Azure Table Storage adapter for Auth.js / NextAuth.js.
Installation
- npm
 - Yarn
 - pnpm
 
npm install next-auth @auth/azure-tables-adapter
yarn add next-auth @auth/azure-tables-adapter
pnpm add next-auth @auth/azure-tables-adapter
TableStorageAdapter()
TableStorageAdapter(
client):Adapter
- Create a table for authentication data, 
authin the example below. 
auth.ts
import type { AuthConfig } from "next-auth"
import { TableStorageAdapter } from "@next-auth/azure-tables-adapter"
import { AzureNamedKeyCredential, TableClient } from "@azure/data-tables"
const credential = new AzureNamedKeyCredential(
  process.env.AZURE_ACCOUNT,
  process.env.AZURE_ACCESS_KEY
)
const authClient = new TableClient(
  process.env.AZURE_TABLES_ENDPOINT,
  "auth",
  credential
)
// For more information on each option (and a full list of options) go to
// https://authjs.dev/reference/configuration/auth-options
export default const authConfig = {
  // https://authjs.dev/reference/core/providers
  providers: [
    // ...
  ],
  adapter: TableStorageAdapter(authClient),
  // ...
} satisfies AuthConfig
Environment variable are as follows:
AZURE_ACCOUNT=storageaccountname
AZURE_ACCESS_KEY=longRandomKey
AZURE_TABLES_ENDPOINT=https://$AZURE_ACCOUNT.table.core.windows.net
Parameters
▪ client: TableClient
Returns
Adapter