Skip to content

Standardize environment variable naming and fix syntax errors across chapters 01-11#465

Merged
leestott merged 2 commits intomainfrom
copilot/standardize-env-var-naming
Feb 27, 2026
Merged

Standardize environment variable naming and fix syntax errors across chapters 01-11#465
leestott merged 2 commits intomainfrom
copilot/standardize-env-var-naming

Conversation

Copy link
Contributor

Copilot AI commented Feb 27, 2026

Inconsistent env var names (AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_CHAT_DEPLOYMENT_NAME) scattered across README code snippets conflicted with .env.example standards (AZURE_AI_PROJECT_ENDPOINT, AZURE_AI_MODEL_DEPLOYMENT_NAME). Several AzureAIProjectAgentProvider instantiations also had a systematic syntax error — a stray ,) that made the code unparseable.

Syntax fixes

Corrected broken AzureAIProjectAgentProvider calls across notebooks and READMEs (lessons 02, 04, 06, 07, 10, 12). Pattern was consistently:

# Before — SyntaxError: stray ),  followed by dangling keyword args
provider = AzureAIProjectAgentProvider(credential=AzureCliCredential()),
    project_endpoint=os.environ["AZURE_AI_PROJECT_ENDPOINT"],
)

# After — framework auto-reads AZURE_AI_PROJECT_ENDPOINT from env
provider = AzureAIProjectAgentProvider(credential=AzureCliCredential())

Env var name standardization

  • 04-tool-use/README.md: AZURE_OPENAI_ENDPOINTAZURE_AI_PROJECT_ENDPOINT
  • 07-planning-design/README.md: removed AZURE_OPENAI_ENDPOINT and AZURE_OPENAI_CHAT_DEPLOYMENT_NAME references; provider now uses env-auto-detection
  • 06-building-trustworthy-agents/README.md: removed incorrect endpoint= / model= params from provider constructor

.env.example and setup docs

Added missing variables so the root .env.example covers all lessons 01–11:

# GitHub Models (Lessons 06 and 08)
GITHUB_TOKEN="..."
GITHUB_ENDPOINT="https://models.inference.ai.azure.com"
GITHUB_MODEL_ID="gpt-4o-mini"

# Bing grounding (Lesson 08 conditional workflow)
BING_CONNECTION_ID="..."

00-course-setup/README.md updated with corresponding lookup instructions for each new variable.

Original prompt

This section details on the original issue you should resolve

<issue_title>Standardize environment variable naming convention across all code samples</issue_title>
<issue_description>## Environment Variable Standardization

Currently, the repository uses inconsistent environment variable naming conventions across different code samples and chapters. This creates confusion for learners and makes the setup process more complex than necessary.

Problem

  • Different samples use varying naming patterns (e.g., AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME vs MODEL_DEPLOYMENT_NAME)
  • Inconsistent variable names between .env.example files and actual code usage
  • Learners need to manage multiple different variable names for similar purposes
  • Setup instructions become unclear due to naming variations

Proposed Solution

  1. Standardize variable naming across all samples

    • Use consistent, descriptive names (e.g., AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_API_KEY)
    • Follow a unified naming convention (Azure service prefix + descriptive suffix)
  2. Update root .env.example to reflect standardized names

  3. Implement backward compatibility with fallback logic

    deployment_name = os.getenv("MODEL_DEPLOYMENT_NAME") or os.getenv("AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME")
  4. Update all English code samples to use the new standardized names

Benefits

✅ Improved developer experience with consistent variable naming
✅ Simplified setup process for beginners
✅ Reduced confusion and support requests
✅ Better maintainability across the repository
✅ Future-proof naming convention for new samples

Scope

  • Root .env.example file
  • All code samples in English chapters (01-11)
  • Documentation updates where environment variables are referenced
  • Maintain backward compatibility to avoid breaking existing setups

Priority

Medium - improves user experience but doesn't break existing functionality

Labels

enhancement documentation good first issue</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@github-actions
Copy link
Contributor

👋 Thanks for contributing @copilot! We will review the pull request and get back to you soon.

Co-authored-by: leestott <2511341+leestott@users.noreply.github.com>
Copilot AI changed the title [WIP] Standardize environment variable naming convention Standardize environment variable naming and fix syntax errors across chapters 01-11 Feb 27, 2026
@leestott leestott marked this pull request as ready for review February 27, 2026 08:45
Copilot AI review requested due to automatic review settings February 27, 2026 08:45
@leestott leestott merged commit 74fe855 into main Feb 27, 2026
5 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Standardizes environment variable naming in lesson docs/notebooks and fixes a recurring AzureAIProjectAgentProvider(...) syntax issue by removing stray ,) fragments and relying on env-based auto-configuration.

Changes:

  • Fixed invalid AzureAIProjectAgentProvider instantiations across notebooks/READMEs by removing dangling keyword args caused by a stray ,).
  • Updated READMEs to remove/replace legacy AZURE_OPENAI_* variables in favor of .env.example’s AZURE_AI_* convention.
  • Expanded root .env.example and setup docs to include GitHub Models and Bing grounding variables used in later lessons.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
12-context-engineering/code_samples/12-chat_summarization.ipynb Fixes provider instantiation syntax and updates messaging to “Azure AI Foundry provider”.
10-ai-agents-production/code_samples/10-python-agent-framework.ipynb Fixes provider instantiation syntax to a valid single call.
07-planning-design/README.md Removes incorrect provider args and legacy env vars; uses provider env auto-detection.
06-building-trustworthy-agents/README.md Removes unsupported/incorrect endpoint/model args from provider constructor.
04-tool-use/README.md Replaces env var name in an AzureOpenAI client snippet and fixes provider instantiation syntax.
02-explore-agentic-frameworks/README.md Fixes repeated provider instantiation syntax errors.
00-course-setup/README.md Documents newly added .env variables for GitHub Models and Bing grounding.
.env.example Adds GitHub Models + Bing grounding variables and clarifies Foundry project endpoint comment.
Comments suppressed due to low confidence (1)

.env.example:6

  • The default AZURE_AI_MODEL_DEPLOYMENT_NAME example value (gpt-4o) appears inconsistent with several lesson snippets that reference gpt-4o-mini. To reduce learner confusion, consider aligning the example value with the model used most frequently in the lessons (or explicitly note that it must match the user’s deployment name and may be gpt-4o-mini depending on what they deployed).
# Model deployment name in your Foundry project (e.g., gpt-4o)
AZURE_AI_MODEL_DEPLOYMENT_NAME="gpt-4o"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# Initialize the Azure OpenAI client
client = AzureOpenAI(
azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT"),
azure_endpoint = os.getenv("AZURE_AI_PROJECT_ENDPOINT"),
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AzureOpenAI(azure_endpoint=...) expects an Azure OpenAI resource endpoint (e.g., https://<resource>.openai.azure.com), not an Azure AI Foundry project endpoint. Using AZURE_AI_PROJECT_ENDPOINT here will misconfigure the client. Consider reverting this line to os.getenv("AZURE_OPENAI_ENDPOINT") (and keep that variable in docs for AzureOpenAI snippets), or switch the example to use the Foundry/Agent provider API consistently instead of AzureOpenAI.

Suggested change
azure_endpoint = os.getenv("AZURE_AI_PROJECT_ENDPOINT"),
azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT"),

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Standardize environment variable naming convention across all code samples

4 participants