Edit

Share via


Prepare your development environment

Set up your development environment to use the Microsoft Foundry SDK. You also need Azure CLI for authentication so that your code can access your user credentials.

Important

This article covers general prerequisites only—language runtimes, global tools, VS Code and extension setup.
It does not include scenario-specific steps like SDK installation or authentication.
When your environment is ready, continue to the quickstart for those instructions.

Prerequisites

Install your programming language

In Visual Studio Code, create a new folder for your project. Open a terminal window in that folder.

First you need to create a new Python environment. DO NOT install packages into your global python installation. You should always use a virtual or conda environment when installing python packages, otherwise you can break your global install of Python.

If needed, install Python

We recommend using Python 3.10 or later, but having at least Python 3.9 is required. If you don't have a suitable version of Python installed, follow the instructions in the VS Code Python Tutorial for the easiest way of installing Python on your operating system.

Create a virtual environment

If you already have Python 3.10 or higher installed, create a virtual environment using the following commands:

py -3 -m venv .venv
.venv\scripts\activate

Activating the Python environment means that when you run python or pip from the command line, you use the Python interpreter contained in the .venv folder of your application.

Note

You can use the deactivate command to exit the python virtual environment, and can later reactivate it when needed.

Install the Python extension for Visual Studio Code

The Python extension for Visual Studio Code supports Python with IntelliSense, debugging, formatting, linting, code navigation, refactoring, variable explorer, test explorer, and environment management.

Install the Python Extension for Visual Studio Code.

Install:

  • Java Development Kit (JDK) 17 or later

Install the Visual Studio Code Extension Pack for Java

The Extension Pack for Java is a collection of popular extensions that can help write, test, and debug Java applications in Visual Studio Code.

Install the Visual Studio Code Extension Pack for Java.

Install Node.js

Ensure you have the necessary tools installed for .NET development.

Install the .NET SDK

You need the .NET SDK (Software Development Kit) to create, build, and run .NET applications. We recommend installing the latest LTS (Long Term Support) version or a later version if required by your project.

  1. Download the .NET SDK from the official .NET download page. Select the appropriate installer for your operating system (Windows, Linux, or macOS).

  2. Follow the installation instructions for your operating system.

  3. Verify the installation by opening a terminal or command prompt and running:

    dotnet --version
    

    The response should be the installed SDK version.

Install the C# Dev Kit for Visual Studio Code

For the best C# development experience in VS Code, install the official C# Dev Kit extension:

  1. Open Visual Studio Code.
  2. Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X).
  3. Search for C# Dev Kit.
  4. Install the extension published by Microsoft. This will also install the base C# extension if you don't already have it.

Create a new .NET Project

You can create a new .NET project using the terminal integrated into Visual Studio Code (Terminal > New Terminal).

For example, to create a new console application:

# Navigate to the directory where you want to create your project
# cd path/to/your/projects

# Create a new console application in a subfolder named MyConsoleApp
dotnet new console -o MyConsoleApp

# Navigate into the newly created project folder
cd MyConsoleApp

You can now open this MyConsoleApp folder in VS Code (File > Open Folder...) to start working on your C# project. VS Code, with the C# Dev Kit extension, will automatically detect the project, enabling features like IntelliSense, debugging, and build tasks.

Install the Azure CLI and sign in

You install the Azure CLI and sign in from your local development environment, so that you can use your user credentials to call Azure OpenAI in Microsoft Foundry Models.

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 signing in.

Install the Azure Developer CLI

The Azure Developer CLI (azd) is an open-source tool that helps you set up and deploy app resources on Azure. It provides simple commands for key stages of development, whether you use a terminal, IDE, or CI/CD pipelines. Install the Azure Developer CLI for your platform.

Install The Foundry VS Code Extension

The Foundry extension for Visual Studio Code lets you deploy models, build AI apps, and work with Agents directly from the VS Code interface. Install The Foundry VS Code Extension.

Install Git

Many of the Microsoft Foundry SDK samples use Git for version control. If you don't have Git installed, follow the instructions for your platform and select your operating system.

Next step