Skip to content

Can't select the environment with Microsoft 365 Agent Toolkit in Visual Studio 2026 #15546

@justingden

Description

@justingden

Describe the bug
I am trying to deploy my Teams app to Azure, and when I go to "Provision in Cloud...", it never asks for my environment and instead fails while trying to process the dev environment, when we have created a prod environment. We have looked for documentation on this subject and how environments get selected, but we can find none.

Our project was originally created as a "Teams Toolkit project, and this extension has been updated to the Microsoft 365 Agent Toolkit, which has worked for local development.

We are using the latest version of Visual Studio 2026 (not Code).

I have included the list of related files and a Copilot assessment of these files under additional context below.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
We expect to be able to select an environment or have another mechanism for selecting an environment through configuration for the various toolkit operations.

Screenshots
If applicable, add screenshots to help explain your problem.

VS Extension Information (please complete the following information):

  • OS: Windows 11
  • Version 18.3.3.25837

CLI Information (please complete the following information):

  • OS: [e.g. iOS8.1]
  • Version [e.g. 22]

Additional context

Microsoft 365 Agents Toolkit — prod Environment Not Appearing

Summary

After creating a prod environment following the standard Teams Toolkit convention (.env.prod in the environmentFolderPath), the Microsoft 365 Agents Toolkit in Visual Studio 2026 does not prompt or allow selection of the prod environment when running Provision or Deploy. Only dev and local are available. The solution has been fully closed and reopened.

Environment

Item Value
IDE Visual Studio Professional 2026 (18.4.0)
Project Type Blazor (.NET 10) Teams Tab App with TeamsFx ProjectCapability
Pipeline Schema teamsapp.yml v1.1.0 (https://aka.ms/teams-toolkit/1.1.0/yaml.schema.json)
OS Windows

File Layout

PI.App.GrowthHub/
├── teamsapp.yml              (v1.1.0, environmentFolderPath: ./env)
├── teamsapp.local.yml        (v1.1.0, local debug only)
├── PI.App.GrowthHub.csproj   (ProjectCapability: TeamsFx)
└── env/
    ├── .env.local            (TEAMSFX_ENV=local)  ← Detected ✅
    ├── .env.local.user
    ├── .env.dev              (TEAMSFX_ENV=dev)    ← Detected ✅
    ├── .env.dev.user
    ├── .env.prod             (TEAMSFX_ENV=prod)   ← NOT Detected ❌
    └── .env.prod.user

File Timestamps (all on disk, verified)

File Size Last Modified
.env.dev 1026 B 3/18/2026 1:08 PM
.env.dev.user 308 B 3/18/2026 1:08 PM
.env.local 1009 B 12/28/2025 10:39 AM
.env.prod 724 B 3/18/2026 12:26 PM
.env.prod.user 288 B 3/18/2026 12:42 PM
teamsapp.yml 6106 B 3/18/2026 12:29 PM
teamsapp.local.yml 6191 B 10/25/2025 9:48 PM

Key Configuration

teamsapp.yml (lines 1–6)

# yaml-language-server: $schema=https://aka.ms/teams-toolkit/1.1.0/yaml.schema.json
version: 1.1.0

environmentFolderPath: ./env

.env.prod (line 2)

TEAMSFX_ENV=prod

.csproj — TeamsFx Capability

<ProjectCapability Include="TeamsFx" />

.csproj.env.*.user files included

<ItemGroup>
  <None Include="env\.env.dev.user" />
  <None Include="env\.env.local.user" />
  <None Include="env\.env.prod.user" />
</ItemGroup>

Note: The .env.prod and other non-.user env files are not explicitly listed as <None> items. It is unclear whether the toolkit discovers environments via filesystem scan of environmentFolderPath or via project item inclusion. local and dev work without explicit inclusion, so this may not be the cause.

What Was Tried

  1. ✅ Verified .env.prod exists on disk at the correct path
  2. ✅ Verified TEAMSFX_ENV=prod is on line 2
  3. ✅ Verified environmentFolderPath: ./env in teamsapp.yml
  4. ✅ Verified PI.App.GrowthHub is set as the startup project
  5. ✅ Fully closed and reopened the solution
  6. prod still does not appear as a selectable environment

Expected Behavior

The Agents Toolkit should discover all .env.* files in the environmentFolderPath directory and present them as selectable environments (excluding local, which uses teamsapp.local.yml). The prod environment should appear alongside dev when running Provision or Deploy.

Actual Behavior

Only dev and local are available. The prod environment is not listed or prompted.

Possible Causes

  1. The toolkit may cache discovered environments and require a full VS restart (not just solution reload) — already tried.
  2. The .env.local.user file has a TEAMSFX_M365_USER_NAME entry that .env.prod.user lacks — possibly triggers special handling.
  3. The toolkit may only discover environments that have been provisioned at least once (i.e., have populated AAD_APP_CLIENT_ID, TEAMS_APP_ID, etc.). The prod env file has all generated values empty.
  4. A VS 2026 18.4.0 regression in environment discovery for the Microsoft 365 Agents Toolkit.

Metadata

Metadata

Assignees

Labels

feature-requestThe issue is a feature requestneeds attentionThis issue needs the attention of a contributor.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions