add KEYCLOAK_TOKEN_ISSUER support and filter azd error messages#19
Merged
madebygps merged 4 commits intoAzure-Samples:mainfrom Dec 11, 2025
Merged
Conversation
…in .env Add KEYCLOAK_TOKEN_ISSUER to fix JWT validation when Keycloak is behind HTTP routes: - Bicep: Pass keycloakTokenIssuer from main.bicep to server.bicep - Server: Set KEYCLOAK_TOKEN_ISSUER env var with fallback to KEYCLOAK_REALM_URL - Python: Use separate issuer URL for token validation vs realm URL for JWKS Fix write_env scripts to handle azd error output: - azd writes "ERROR: key not found" to stdout instead of stderr - Filter ERROR messages before writing to .env file - Prevents error text from polluting local environment files
pamelafox
reviewed
Dec 10, 2025
pamelafox
reviewed
Dec 10, 2025
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request enhances the Keycloak authentication configuration by adding support for explicitly specifying the token issuer and improves the robustness of environment variable extraction scripts. The changes allow for more flexible Keycloak deployments where the token issuer URL differs from the realm URL, while also preventing error messages from being written to .env files.
Key Changes:
- Added
KEYCLOAK_TOKEN_ISSUERenvironment variable support throughout the deployment pipeline, with proper fallback toKEYCLOAK_REALM_URLwhen not set - Implemented error message filtering in environment generation scripts (
write_env.shandwrite_env.ps1) to prevent invalid values from being written whenazdcommands fail - Updated the Spanish README with comprehensive documentation covering all deployment scenarios and usage instructions
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| spanish/README.md | Complete translation update with expanded documentation for all deployment scenarios, local development, and authentication configurations |
| servers/auth_mcp.py | Added KEYCLOAK_TOKEN_ISSUER environment variable retrieval with fallback to KEYCLOAK_REALM_URL for JWT verification |
| infra/write_env.sh | Added error message filtering for Keycloak and Entra Proxy variables, plus support for writing KEYCLOAK_TOKEN_ISSUER to .env |
| infra/write_env.ps1 | PowerShell version of error filtering and KEYCLOAK_TOKEN_ISSUER support, maintaining parity with bash script |
| infra/server.bicep | Added keycloakTokenIssuer parameter and environment variable configuration with conditional fallback logic |
| infra/main.bicep | Added keycloakTokenIssuer parameter passing to server module and output variable for environment scripts |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
pamelafox
approved these changes
Dec 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request enhances the Keycloak authentication configuration by introducing a new environment variable for the Keycloak token issuer and improving the robustness of environment variable extraction scripts. The main goal is to allow the token issuer to be explicitly set, which provides more flexibility and better alignment with various Keycloak deployment scenarios. Additionally, the scripts that generate environment files now filter out error messages from
azdcommands, preventing invalid values from being written.Keycloak authentication improvements:
KEYCLOAK_TOKEN_ISSUERenvironment variable, which is now passed through the deployment pipeline and used by the server for JWT verification. If not set, it defaults to the realm URL. [1] [2] [3] [4] [5]Deployment script robustness:
write_env.ps1andwrite_env.shto filter out error messages fromazdoutput when retrieving environment variables, preventing invalid values (such as error strings) from being written to the.envfile. This was applied to Keycloak and Entra Proxy related variables. [1] [2]