Azure AD OAuth2 Setup¶
This guide shows how to configure Azure Active Directory as the OAuth2 provider for the OAuth2 Sidecar.
1. Register an Application in Azure AD¶
- Go to Azure Portal → Azure Active Directory → App registrations
- Click New registration
- Set:
- Name:
OAuth2 Sidecar - Supported account types: Choose based on your scenario
- Redirect URI:
https://my-app.example.com/oauth2/callback - Click Register
2. Configure API Permissions¶
- In your app registration, go to API permissions
- Ensure
openidandprofilescopes are included - Add additional scopes if needed (e.g.
email)
3. Collect Required Values¶
From your app registration: - Application (client) ID - Directory (tenant) ID - Client Secret (create one under Certificates & secrets)
4. Configure the Helm Chart¶
In your values.yaml:
domain: example.com
cookieDomain: .example.com
oauth:
provider: azure
clientID: "YOUR_CLIENT_ID"
clientSecret: "YOUR_CLIENT_SECRET"
cookieSecret: "$(openssl rand -base64 32)"
azure:
tenant: "YOUR_TENANT_ID"
resource: "api://YOUR_APP_ID_URI" # Optional: custom resource/audience
Or using a pre-created secret:
kubectl create secret generic oauth2-proxy-secret \
--from-literal=client-id=YOUR_CLIENT_ID \
--from-literal=client-secret=YOUR_CLIENT_SECRET \
--from-literal=cookie-secret=$(openssl rand -base64 32)
5. Test the Flow¶
- Deploy the Helm chart with your configuration
- Deploy an example app (e.g.
examples/simple-app) - Open
https://simple-app.example.com - You should be redirected to Azure AD to sign in
- After successful login, you will be redirected back to your app