Edit

Share via


Set up your development environment

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

Prerequisites

  • An Azure subscription. If you don't have an Azure subscription, create a free account.

Install your programming language

In the IDE of your choice, 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:

  • Java Development Kit (JDK) 17 or later

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 Azure AI 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 window open to run your scripts from here as well, now that you've signed in.

Next step