OfficeDev / teams-toolkit

Developer tools for building Teams apps
Other
434 stars 171 forks source link

Multiple local environments #11943

Open goncafab opened 3 days ago

goncafab commented 3 days ago

Is your feature request related to a problem? Please describe. I'm developing a Python Teams Copilot application that uses SSO, using the Teams AI library. To be able to use SSO, I need to setup a OAuth connection in my Azure Bot resource.

However, Teams Toolkit doesn't create a Azure Bot resource, but instead registers a bot using the Bot Framework, which does not allow to setup a OAuth connection. As I'm using a Microsoft 365 developer sandbox subscription, I do not have access to an associated Azure account to migrate the resource to.

As I have an enterprise Azure subscription with an Azure Bot resource setup with an OAuth connection, I can change the configurations to point to that resource, manually set up a dev tunnel to my machine, and change the message endpoints to it. However, this process is quite slow, so I'd like to automate it. I've setup a bicep definition to update my Azure Bot resource every time I run the VSCode debug task.

The issue here is that I had chose between either changing the default teamsapp.yml, or the teamsapp.local.yml, and in turn losing the setup of my remote resources, or having a stable local development environment when working as a team, as some tasks might not need to have SSO enabled.

Describe the solution you'd like

I'd like to be able to run different steps for provision and deploy, depending on the what I'm targeting.

When running local and resulting in loading teamsapp.local.yml, I'd like for the current behavior to be maintained, as it enables each developer to use their own developer account independently.

When running dev and resulting in loading teamsapp.yml, I'd like for provision to happen of all my remote resources, as well deployment and publishing of the application.

When running myenv and resulting in loading teamsapp.myenv.yml if it exists, I'd like to run a set of custom steps for my provision and deploy cycles.

Describe alternatives you've considered

I've tried using multiple variables in my .env files to control with conditions which resources are deployed or updated, but it gets extremely confusing and doesn't cover all cases.

I've ended up changing the default steps in the teamsapp.yml file, but then I lose the provisioning setup of my other resources, and not only the Azure Bot definition.

microsoft-github-policy-service[bot] commented 3 days ago

Thank you for contacting us! Any issue or feedback from you is quite important to us. We will do our best to fully respond to your issue as soon as possible. Sometimes additional investigations may be needed, we will usually get back to you within 2 days by adding comments to this issue. Please stay tuned.

blackchoey commented 1 day ago

@goncafab My understanding to your myenv environment is you want to use an Azure Bot Service when debugging your app locally. You're able to achieve this by customizing the teamsapp.local.yml file. Here's an example you can refer to update your project's teamsapp.local.yml: https://github.com/microsoft/teams-ai/blob/main/js/samples/05.authentication/b.oauth-bot/teamsapp.local.yml. In this way, you should be able to avoid introducing the third myenv environment. For people who want to use their own developer account, they can login to Teams Toolkit using the developer account. For people who want to use their enterprise account, they can login to Teams Toolkit using the enterprise account.