fix: dev to main - Refactor credential retrieval logic for environment compatibility - #1127
Merged
Conversation
refactor: update credential retrieval logic based on environment
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors Azure credential selection in the MCP server’s image generation service to choose credentials based on APP_ENV, improving alignment between local development and deployed environments.
Changes:
- Add
osimport to readAPP_ENV. - Update
_get_credential()to useDefaultAzureCredentialwhenAPP_ENV=dev, otherwise useManagedIdentityCredentialwith the configured client ID.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Roopan-Microsoft
previously approved these changes
Aug 6, 2026
fix: DependaBot alerts fixes
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 10 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- src/App/package-lock.json: Generated file
Suppressed comments (1)
src/mcp_server/pyproject.toml:23
- The PR description focuses on refactoring Azure credential selection in
image_service.py, but this PR also changes a large set of dependency versions across multiple Python projects and the frontend (FastAPI/Uvicorn/Pydantic/OpenAI, React Router/Vite/Vitest, etc.). This increases review and rollout risk; please either split the dependency upgrades into a separate PR with rationale/validation, or update the PR description to explicitly cover these changes and testing performed.
"fastmcp==3.2.0",
"fastapi==0.136.1",
"uvicorn[standard]==0.35.0",
"python-dotenv==1.1.1",
"azure-identity==1.25.3",
"pydantic==2.13.4",
Roopan-Microsoft
approved these changes
Aug 6, 2026
Vinay Sharma (Vinay-Microsoft)
approved these changes
Aug 6, 2026
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.
Purpose
This pull request updates the logic for obtaining Azure credentials in the
image_service.pyfile to better distinguish between development and production environments. The main change is to select the appropriate credential type based on theAPP_ENVenvironment variable.Credential selection logic:
_get_credentialfunction to check theAPP_ENVenvironment variable and useDefaultAzureCredentialin development environments andManagedIdentityCredentialwith the configured client ID otherwise. This ensures the correct authentication method is used depending on the deployment context.osmodule to support reading environment variables.Does this introduce a breaking change?
Golden Path Validation
Deployment Validation
Other Information
This pull request updates the logic for obtaining Azure credentials in the
image_service.pyservice. The main change is to select credentials based on the current environment, improving local development experience and deployment flexibility.Credential selection improvements:
_get_credentialfunction to check theAPP_ENVenvironment variable and useDefaultAzureCredentialwithrequire_envvar=Truein development environments, while continuing to useManagedIdentityCredentialwith the configured client ID in other environments.osmodule to support reading environment variables in the credential selection logic.