Skip to content

Instantly share code, notes, and snippets.

@paulyuk
Last active December 14, 2025 23:10
Show Gist options
  • Select an option

  • Save paulyuk/7a1fe458cad4add2b5bab60680968919 to your computer and use it in GitHub Desktop.

Select an option

Save paulyuk/7a1fe458cad4add2b5bab60680968919 to your computer and use it in GitHub Desktop.
Bootstrapping your Microsoft Foundry environment for Agents

Bootstrapping your Microsoft Foundry environment for Agents

These are the simplest instructions for creating a project and running an AI Agent.

Phase 1: Create the Project (Foundry + Azure resources needed)

All paths start here. This sets up the cloud resources.

Deploy to Azure

  1. Click the "Deploy to Azure" button above
  2. Sign in with your Azure credentials
  3. Configure:
    • Region: Select East US 2 (or your preferred region)
    • Environment Name: Enter vibe-agent-offsite (or your preferred name)
    • principalID: enter the result of the following CLI command so your User identity gets RBAC roles/permissions needed (portal limitation)
    az ad signed-in-user show --query id -o tsv
    
  4. Deploy: Click Review + Create, then Create
    • Note: Provisioning takes 2-3 minutes

What gets created:

  • Resource Group: rg-<your-environment-name> (e.g., rg-vibe-agent-offsite)
  • Model Deployment: Named chat using GPT-4.1-mini
  • Azure AI Foundry Project: Named <your-environment-name><unique-id> (e.g. vibe-agent-12345)
  • Go to Foundry Portal and look for your project starting with vibe (view All Resources if needed)

Alternative: Each sample repository below contains Bicep infrastructure you can deploy using azd provision or azd up.


Phase 2: Build the Agent

Choose your path - with code focus or the portal

Path A: The Code (Developer Experience using Agent Framework)

Best for: Understanding SDK implementation and running locally.

1. Gather Your Credentials

Before running code, you need two values from your Azure/Foundry settings:

  • Azure OpenAI Endpoint: (e.g., https://<your-resource>.openai.azure.com/)
  • Deployment Name: (The name of the model you deployed, e.g., chat)

The endpoint we want for Agent Framework is the Azure OpenAI one.
It's the foundry project resource, overview (old portal): image Click on the Azure OpenAI tab. Get this endpoint. It should not have a route. image

E.g. a valid one looks like:

https://agent-ai-servicesou6taoycpkkwc.openai.azure.com/

2. Configure Environment Variables

Copy the block matching your OS into your terminal to set the variables for the current session.

Windows PowerShell

$env:AZURE_OPENAI_ENDPOINT = "https://agent-ai-NNNNN.openai.azure.com/"
$env:AZURE_OPENAI_DEPLOYMENT_NAME = "chat"

macOS / Linux

export AZURE_OPENAI_ENDPOINT="https://agent-ai-NNNNN.openai.azure.com/"
export AZURE_OPENAI_DEPLOYMENT_NAME="chat"

Note: Replace https://agent-ai-NNNNN... with your actual endpoint URL.

3. Run the Agent

Option 1: Python

  1. Clone the repository.
  2. Open your terminal to the repo folder.
  3. Run the environment variable commands from Step 2.
  4. Follow the README.md to install dependencies in a venv and run the agent script (python main.py).

Option 2: C# / .NET

  1. Clone the repository.
  2. Open your terminal to the repo folder.
  3. Run the environment variable commands from Step 2.
  4. Follow the README.md to run the app (dotnet run).

Path B: The Portal UX (No-Code using Agent Service)

Best for: Rapid prototyping, testing prompts, and visual verification.

  1. Enter Agent Builder: In your new project, look at the left-hand navigation menu and click Agents.
  2. Create: Click + Create Agent.
  3. Setup:
    • Name: Give your agent a name.
    • Model: Select gpt-4.1-mini from the dropdown. If no model is listed, click "Connect & deploy" to add one named gpt-4.1-mini.
    • Instructions: Type a simple system prompt (e.g., "You are a helpful project management assistant.").
  4. Test: Use the Playground chat window on the right to type a message and verify the response.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment