> ## Documentation Index
> Fetch the complete documentation index at: https://hobbyist-e43fa225.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Prepare your development environment

> Set up your development environment with language runtimes, Azure CLI, and tools for Microsoft Foundry development.

export const ZonePivot = ({group, options = [], defaultValue, label = "Choose an experience"}) => {
  const values = options.map(option => option.id);
  const optionKey = options.map(option => `${option.id}:${option.title}`).join("|");
  const [activePivot, setActivePivot] = useState(defaultValue || values[0]);
  const slugify = value => value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
  const resolvePivot = () => {
    if (typeof window === "undefined") return defaultValue || values[0];
    const params = new URLSearchParams(window.location.search);
    const requested = params.get("pivots");
    if (requested) {
      const requestedIds = requested.split(",").map(value => value.trim()).filter(Boolean);
      const match = requestedIds.find(id => values.includes(id));
      if (match) return match;
    }
    const hash = window.location.hash.replace(/^#/, "");
    if (hash) {
      const match = options.find(option => option.id === hash || slugify(option.title) === hash);
      if (match) return match.id;
    }
    try {
      const stored = window.localStorage.getItem(`foundry-zone-pivot:${group}`);
      if (values.includes(stored)) return stored;
    } catch {
      return defaultValue || values[0];
    }
    return defaultValue || values[0];
  };
  const publishPivotChange = value => {
    if (typeof window === "undefined") return;
    window.dispatchEvent(new CustomEvent("foundry-zone-pivot-change", {
      detail: {
        group,
        value
      }
    }));
  };
  const syncTableOfContents = () => {
    if (typeof window === "undefined") return;
    window.requestAnimationFrame(() => {
      const toc = document.getElementById("table-of-contents-content");
      if (!toc) return;
      const links = Array.from(toc.querySelectorAll('a[href^="#"]'));
      for (const link of links) {
        const item = link.closest("li");
        const rawId = link.getAttribute("href")?.slice(1);
        if (!item || !rawId) continue;
        let id = rawId;
        try {
          id = decodeURIComponent(rawId);
        } catch {}
        item.style.display = document.getElementById(id) ? "" : "none";
      }
    });
  };
  useEffect(() => {
    const resolvedPivot = resolvePivot();
    setActivePivot(resolvedPivot);
    publishPivotChange(resolvedPivot);
    window.setTimeout(syncTableOfContents, 0);
  }, [group, defaultValue, values.join("|"), optionKey]);
  const selectPivot = value => {
    setActivePivot(value);
    if (typeof window !== "undefined") {
      try {
        window.localStorage.setItem(`foundry-zone-pivot:${group}`, value);
      } catch {}
      const url = new URL(window.location.href);
      const current = url.searchParams.get("pivots");
      const preserved = current ? current.split(",").map(id => id.trim()).filter(id => id && !values.includes(id)) : [];
      url.searchParams.set("pivots", [...preserved, value].join(","));
      window.history.replaceState(null, "", `${url.pathname}${url.search}${url.hash}`);
    }
    publishPivotChange(value);
    window.setTimeout(syncTableOfContents, 0);
  };
  if (options.length < 2) return null;
  return <div className="not-prose my-6 border-b border-slate-200 pb-3 dark:border-slate-800">
      <div className="mb-2 text-xs font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400">
        {label}
      </div>
      <div className="flex flex-wrap gap-2" role="tablist" aria-label={label}>
        {options.map(option => {
    const selected = option.id === activePivot;
    return <button key={option.id} type="button" role="tab" aria-selected={selected} onClick={() => selectPivot(option.id)} className={`rounded-md border px-3 py-1.5 text-sm font-medium transition ${selected ? "border-slate-900 bg-slate-900 text-white shadow-sm dark:border-slate-100 dark:bg-slate-100 dark:text-slate-950" : "border-slate-200 bg-white text-slate-700 hover:border-slate-400 hover:text-slate-950 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-200 dark:hover:border-slate-500"}`}>
              {option.title}
            </button>;
  })}
      </div>
    </div>;
};

export const ZoneContent = ({group, value, options = [], values = [], defaultValue, children}) => {
  const optionKey = options.map(option => `${option.id}:${option.title}`).join("|");
  const [activePivot, setActivePivot] = useState(defaultValue || values[0]);
  const slugify = value => value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
  const resolvePivot = () => {
    if (typeof window === "undefined") return defaultValue || values[0];
    const params = new URLSearchParams(window.location.search);
    const requested = params.get("pivots");
    if (requested) {
      const requestedIds = requested.split(",").map(value => value.trim()).filter(Boolean);
      const match = requestedIds.find(id => values.includes(id));
      if (match) return match;
    }
    const hash = window.location.hash.replace(/^#/, "");
    if (hash) {
      const match = options.find(option => option.id === hash || slugify(option.title) === hash);
      if (match) return match.id;
    }
    try {
      const stored = window.localStorage.getItem(`foundry-zone-pivot:${group}`);
      if (values.includes(stored)) return stored;
    } catch {
      return defaultValue || values[0];
    }
    return defaultValue || values[0];
  };
  useEffect(() => {
    setActivePivot(resolvePivot());
  }, [group, defaultValue, values.join("|"), optionKey]);
  useEffect(() => {
    const onPivotChange = event => {
      if (event.detail?.group === group && values.includes(event.detail.value)) {
        setActivePivot(event.detail.value);
      }
    };
    window.addEventListener("foundry-zone-pivot-change", onPivotChange);
    return () => window.removeEventListener("foundry-zone-pivot-change", onPivotChange);
  }, [group, values.join("|")]);
  if (activePivot !== value) return null;
  return <>{children}</>;
};

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.

In this article, you install language runtimes, Azure CLI, Azure Developer CLI, the Microsoft Foundry Toolkit for Visual Studio Code extension, and Git.

<Info>
  This article covers **general prerequisites** only, such as language runtimes, global tools, and VS Code and extension setup.\
  It doesn't cover scenario-specific steps like SDK installation or authentication.\
  When your environment is ready, continue to the [quickstart](../tutorials/quickstart-create-foundry-resources) for those instructions.
</Info>

## 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](https://azure.microsoft.com/pricing/purchase-options/azure-account?cid=msft_learn).
* Download, install, and configure Visual Studio Code, or the IDE of your choice. For more information, see [Download Visual Studio Code](https://code.visualstudio.com/Download).
* To create and manage Foundry resources, one of the following Azure RBAC roles
  * **Foundry Project Manager** (for managing Foundry projects)

<Info />

> 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). Owner is necessary for additional role assignments required for other scenarios in Foundry. To ensure you are unblocked for all scenarios in Foundry, Owner is the role assignment required.
* To use project but not create new resources, you need at least:

  * **Foundry User** on the projects you use (least-privilege role for development)

  For details on each role's permissions, see [Role-based access control for Microsoft Foundry](../concepts/rbac-foundry).

## Install your programming language

<ZonePivot group="programming-language-csharp__programming-language-java__programming-language-javascript__programming-language-python" options={[{"id": "programming-language-python", "title": "Python"}, {"id": "programming-language-java", "title": "Java"}, {"id": "programming-language-javascript", "title": "JavaScript"}, {"id": "programming-language-csharp", "title": "C#"}]} defaultValue="programming-language-python" />

<ZoneContent group="programming-language-csharp__programming-language-java__programming-language-javascript__programming-language-python" value="programming-language-python" options={[{"id": "programming-language-python", "title": "Python"}, {"id": "programming-language-java", "title": "Java"}, {"id": "programming-language-javascript", "title": "JavaScript"}, {"id": "programming-language-csharp", "title": "C#"}]} values={["programming-language-python", "programming-language-java", "programming-language-javascript", "programming-language-csharp"]} defaultValue="programming-language-python">
  In Visual Studio Code, create a new folder for your project. Open a terminal window in that folder.

  First, create a new Python environment. Don't install packages into your global Python installation. Always use a virtual or conda environment when installing Python packages. Otherwise, you can break your global install of Python.

  ### If needed, install Python

  Use Python 3.10 or later, but 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](https://code.visualstudio.com/docs/python/python-tutorial#_install-a-python-interpreter) 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 by using the following commands:

  <CodeGroup>
    ```bash Windows theme={null}
        py -3 -m venv .venv
        .venv\scripts\activate
    ```

    ```bash Linux theme={null}
        python3 -m venv .venv
        source .venv/bin/activate
    ```

    ```bash macOS theme={null}
        python3 -m venv .venv
        source .venv/bin/activate
    ```
  </CodeGroup>

  When you activate the Python environment, running `python` or `pip` from the command line uses the Python interpreter in the `.venv` folder of your application.

  <Note>
    Use the `deactivate` command to exit the Python virtual environment. You can reactivate it later when needed.
  </Note>

  ### 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](https://marketplace.visualstudio.com/items?itemName=ms-python.python).
</ZoneContent>

<ZoneContent group="programming-language-csharp__programming-language-java__programming-language-javascript__programming-language-python" value="programming-language-java" options={[{"id": "programming-language-python", "title": "Python"}, {"id": "programming-language-java", "title": "Java"}, {"id": "programming-language-javascript", "title": "JavaScript"}, {"id": "programming-language-csharp", "title": "C#"}]} values={["programming-language-python", "programming-language-java", "programming-language-javascript", "programming-language-csharp"]} defaultValue="programming-language-python">
  Install:

  * Java Development Kit (JDK) 17 or later
    * We recommend the [Microsoft Build of OpenJDK](https://learn.microsoft.com/java/openjdk/download), which is a free, Long-Term Support (LTS) distribution of OpenJDK

  ### Install the Visual Studio Code Extension Pack for Java

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

  [Install the Visual Studio Code Extension Pack for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack).
</ZoneContent>

<ZoneContent group="programming-language-csharp__programming-language-java__programming-language-javascript__programming-language-python" value="programming-language-javascript" options={[{"id": "programming-language-python", "title": "Python"}, {"id": "programming-language-java", "title": "Java"}, {"id": "programming-language-javascript", "title": "JavaScript"}, {"id": "programming-language-csharp", "title": "C#"}]} values={["programming-language-python", "programming-language-java", "programming-language-javascript", "programming-language-csharp"]} defaultValue="programming-language-python">
  Install [Node.js](https://nodejs.org/) (version 20 or later is recommended).
</ZoneContent>

<ZoneContent group="programming-language-csharp__programming-language-java__programming-language-javascript__programming-language-python" value="programming-language-csharp" options={[{"id": "programming-language-python", "title": "Python"}, {"id": "programming-language-java", "title": "Java"}, {"id": "programming-language-javascript", "title": "JavaScript"}, {"id": "programming-language-csharp", "title": "C#"}]} values={["programming-language-python", "programming-language-java", "programming-language-javascript", "programming-language-csharp"]} defaultValue="programming-language-python">
  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](https://dotnet.microsoft.com/download). 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:

     ```bash theme={null}
     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:

  ```bash theme={null}
  # 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.
</ZoneContent>

## Install the Azure CLI and sign in

You install the [Azure CLI](https://learn.microsoft.com/cli/azure/what-is-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:

<CodeGroup>
  ```powershell Windows theme={null}
      winget install -e --id Microsoft.AzureCLI
  ```

  ```bash Linux theme={null}
      curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
  ```

  ```bash macOS theme={null}
      brew update && brew install azure-cli
  ```
</CodeGroup>

You can follow instructions [How to install the Azure CLI](https://learn.microsoft.com/cli/azure/install-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](https://learn.microsoft.com/azure/developer/azure-developer-cli/install-azd).

Many of the [AI solution templates](../how-to/develop/ai-template-get-started) include a deployment option using `azd`.

## Install the Microsoft Foundry Toolkit for Visual Studio Code extension

The Foundry Toolkit lets you deploy models, build AI apps, and work with Agents directly from the VS Code interface.

Follow the detailed instructions to [install and setup](https://code.visualstudio.com/docs/intelligentapps/overview#_install-and-setup) the Foundry Toolkit.

## Install Git

Git is required to clone Foundry SDK samples. If you don't have Git installed, [follow the instructions for your platform](https://git-scm.com/downloads) and select your operating system.

## Troubleshooting

| Issue                                 | Resolution                                                                                                    |
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| Command not found after install       | Close and reopen your terminal, or restart VS Code, so PATH changes take effect.                              |
| `az login` fails with a browser error | Run `az login --use-device-code` to authenticate using a device code flow instead.                            |
| Python not found                      | Use `python3` instead of `python` on macOS/Linux, or install a supported version (3.9 or later).              |
| Permission denied during install      | On macOS/Linux, avoid `sudo pip install`. Use a [virtual environment](#create-a-virtual-environment) instead. |

## Related content

<Card title="Use the Microsoft Foundry Skill in coding agents" icon="arrow-right" href="../how-to/develop/use-microsoft-foundry-skill.md" />

* [Get started with Foundry](../quickstarts/get-started-code)

<ZoneContent group="programming-language-csharp__programming-language-java__programming-language-javascript__programming-language-python" value="programming-language-python" options={[{"id": "programming-language-python", "title": "Python"}, {"id": "programming-language-java", "title": "Java"}, {"id": "programming-language-javascript", "title": "JavaScript"}, {"id": "programming-language-csharp", "title": "C#"}]} values={["programming-language-python", "programming-language-java", "programming-language-javascript", "programming-language-csharp"]} defaultValue="programming-language-python">
  - [Microsoft Foundry SDK Reference documentation](https://learn.microsoft.com/python/api/overview/azure/ai-projects-readme)
</ZoneContent>

<ZoneContent group="programming-language-csharp__programming-language-java__programming-language-javascript__programming-language-python" value="programming-language-csharp" options={[{"id": "programming-language-python", "title": "Python"}, {"id": "programming-language-java", "title": "Java"}, {"id": "programming-language-javascript", "title": "JavaScript"}, {"id": "programming-language-csharp", "title": "C#"}]} values={["programming-language-python", "programming-language-java", "programming-language-javascript", "programming-language-csharp"]} defaultValue="programming-language-python">
  * [.NET SDK Reference documentation](https://learn.microsoft.com/dotnet/api/overview/azure/ai.projects-readme)
</ZoneContent>

<ZoneContent group="programming-language-csharp__programming-language-java__programming-language-javascript__programming-language-python" value="programming-language-javascript" options={[{"id": "programming-language-python", "title": "Python"}, {"id": "programming-language-java", "title": "Java"}, {"id": "programming-language-javascript", "title": "JavaScript"}, {"id": "programming-language-csharp", "title": "C#"}]} values={["programming-language-python", "programming-language-java", "programming-language-javascript", "programming-language-csharp"]} defaultValue="programming-language-python">
  * [JavaScript/TypeScript SDK Reference documentation](https://learn.microsoft.com/javascript/api/overview/azure/ai-projects-readme)
</ZoneContent>

<ZoneContent group="programming-language-csharp__programming-language-java__programming-language-javascript__programming-language-python" value="programming-language-java" options={[{"id": "programming-language-python", "title": "Python"}, {"id": "programming-language-java", "title": "Java"}, {"id": "programming-language-javascript", "title": "JavaScript"}, {"id": "programming-language-csharp", "title": "C#"}]} values={["programming-language-python", "programming-language-java", "programming-language-javascript", "programming-language-csharp"]} defaultValue="programming-language-python">
  * [Java SDK Reference documentation](https://learn.microsoft.com/java/api/overview/azure/ai-projects-readme)
</ZoneContent>
