แก้ไข

Prepare your development environment

Prepare your development environment to build with the Microsoft Foundry. You need a supported programming language, the Azure CLI for authentication, Git, and Foundry developer tools.

Tip

Foundry DevPack is the recommended way to install the developer tools in one command. You can also install each tool separately.

Important

This article covers general prerequisites, global tools, and Visual Studio Code setup. It doesn't cover scenario-specific SDK packages or authentication code. When your environment is ready, continue to the quickstart.

Prerequisites

  • An Azure account with an active subscription. If you don't have one, create a free Azure account, which includes a free trial subscription.

  • Download, install, and configure Visual Studio Code, or use the IDE of your choice.

  • To create and manage Foundry resources, use one of these Azure RBAC roles:

    • Foundry Project Manager to manage Foundry projects.

    Important

    The Foundry RBAC roles were recently renamed. Foundry User, Foundry Owner, Foundry Account Owner, and Foundry Project Manager were previously named Azure AI User, Azure AI Owner, Azure AI Account Owner, and Azure AI Project Manager. You might still see the previous names in some places while the rename rolls out. The role IDs and core permissions are unchanged by the rename.

    • Owner for subscription-level permissions and role assignments required by some scenarios.
  • To use an existing project without creating resources, you need at least Foundry User on the project.

For details about each role, see Role-based access control for Microsoft Foundry.

Install Foundry DevPack

Foundry DevPack installs the Foundry developer tools for your editor, terminal, and coding agent. Run the command for your operating system.

Windows

winget install Microsoft.FoundryDevPack

macOS

brew install --cask microsoft/foundry/devpack && foundry-devpack install

Linux

curl -fsSL https://aka.ms/foundry-devpack-install.sh | bash

DevPack installs these tools:

Tool What you can do
Microsoft Foundry Toolkit for Visual Studio Code Build, test, evaluate, and deploy from Visual Studio Code.
azd and azd ai Scaffold, deploy, evaluate, and automate from the terminal.
Foundry Canvas (preview) Design and deploy hosted agents with a guided Copilot canvas.
Microsoft Foundry Skill Give coding agents reusable guidance for Foundry workflows.

Continue with the following sections to set up your programming language, sign in with the Azure CLI, and install Git.

Work with a programming language

Use the language that your application requires. Expand a section if you need to install its runtime or Visual Studio Code extension.

Python

Install Python 3.10 or later. Python 3.9 is the minimum supported version. Create a virtual environment for your project instead of installing packages globally.

Windows

py -3 -m venv .venv
.\.venv\Scripts\Activate.ps1

macOS and Linux

python3 -m venv .venv
source .venv/bin/activate

For editor support, install the Python extension for Visual Studio Code.

Java

Install JDK 17 or later. The Microsoft Build of OpenJDK is a free Long-Term Support distribution. For editor support, install the Visual Studio Code Extension Pack for Java.

JavaScript/TypeScript

Install Node.js. Version 20 or later is recommended.

C#

Install the latest Long-Term Support version of the .NET SDK. For editor support, install C# Dev Kit for Visual Studio Code.

Install the Azure CLI and sign in

You install the Azure CLI and sign in from your local development environment so that your code can use your user credentials to call Azure services through Foundry.

In most cases you can install Azure CLI from your terminal using the following command:

winget install -e --id Microsoft.AzureCLI

You can follow instructions How to install the Azure CLI if these commands don't work for your particular operating system or setup.

After you install the Azure CLI, sign in using the az login command and sign-in using the browser:

az login

Alternatively, you can sign in manually via the browser with a device code.

az login --use-device-code

Keep this terminal open to run scripts after you sign in.

Install Git

To clone Foundry SDK samples, you need Git. If you don't have Git installed, download and install it from the Git website.

Install developer tools individually

If you don't use Foundry DevPack, install each developer tool separately:

  1. Install the Azure Developer CLI.
  2. Install all Foundry extensions for azd:
    azd ext install microsoft.foundry
    
    To install individual extensions instead, see Install the Azure Developer CLI Foundry extensions.
  3. Install the editor and coding-agent tools:

Many AI solution templates support deployment with azd.

Troubleshooting

Issue Resolution
Command not found after installation Close and reopen your terminal, or restart Visual Studio Code, so that PATH changes take effect.
az login fails with a browser error Run az login --use-device-code to authenticate with a device code.
Python isn't found Use python3 instead of python on macOS or Linux, or install Python 3.9 or later.
Permission denied during Python package installation On macOS or Linux, don't use sudo pip install. Use a virtual environment instead.