Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In this quickstart, you learn how to use agent mode in GitHub Copilot for Azure to bring your existing application to Azure. It demonstrates how agent mode helps you define Azure infrastructure, deploy your application to Azure, and create a CI/CD pipeline.
GitHub Copilot for Azure supports two modes:
- Ask mode allows you to learn about your deployed Azure resources and about Azure in general using the latest information published to Microsoft Learn. It might provide instructions or even source code, but you take action or edit files yourself.
- Agent mode allows you to command GitHub Copilot to take action in your project, including creating and editing files, executing commands in the terminal window, and so on.
Prerequisites
For complete setup instructions, see the Get started article. Make sure that you have the following items:
An Azure account and access to an Azure subscription. For details on how to set them up, see the pricing page for Azure accounts.
A GitHub account and a GitHub Copilot subscription. For details on how to set them up, see Creating an account on GitHub and Quickstart for GitHub Copilot, respectively.
Visual Studio Code. For details on how to download and install it, see Setting up Visual Studio Code.
The GitHub Copilot extension and the GitHub Copilot Chat extension. For instructions on how to install these extensions, see Set up GitHub Copilot in VS Code and Getting started with GitHub Copilot Chat in VS Code, respectively.
Important
GitHub Copilot isn't included in Visual Studio Subscriptions and is a separate subscription managed by GitHub. For questions regarding GitHub Copilot subscriptions and Support, see Individual Subscriptions or Business subscriptions.
Define Azure infrastructure for your application
In this section, use GitHub Copilot agent mode to create Bicep deployment files and an azd template for the application.
Open your existing application in Visual Studio Code.
If you want to follow along with this tutorial, you can clone the following repo from GitHub to your local computer:
git clone https://github.com/Azure-Samples/storage-blob-upload-from-webapp.git
In Visual Studio Code, on the Title Bar, select the Open Chat icon (the GitHub Copilot logo) to open the chat pane in the Secondary side bar. Select Agent under the chat text box.
To start a new chat session, select the plus icon (+) on the pane's title bar.
In the chat text box at the bottom of the pane, type the following prompt. Then select Send (paper airplane icon) or select Enter on your keyboard.
Help me deploy my project to Azure
Copilot Agent analyzes the project, recommend Azure services, and generate Bicep files. You might see a response like the following example.
Important
Each time GitHub Copilot for Azure answers the prompt the response's wording is different due to how large language models (LLMs) generate responses. It's possible your experience might vary from this article. Take the time to read GitHub Copilot's responses and choose the correct course of action. If you're unsure how to proceed, ask GitHub Copilot what it intends to do and why.
Select Continue and Copilot Agent finishes analyzing the project and starts to generate the necessary files. You might see a response like the following example.
Select Continue and Copilot generates the necessary files for deployment. You might see a few files generated in the project and a response like the following example.
Deploy your application
Next, Copilot agent wants to run a predeployment check.
Select Continue and Copilot agent checks if the app is ready to deploy with
azd
. If there's an issue, Copilot agent fixes it and checks again, like in the following example.Once the predeployment check passes, Copilot agent continues with the deployment process. It checks for a few dependencies first. You might see a response like the following example.
Select Continue for each dependency check. Copilot agent asks if we want to proceed with deployment. You might see a response like the following example.
Select Continue. Copilot agent should open the terminal on run
azd up
on your behalf. Follow the required steps in the terminal.You might encounter an error with .NET version; Copilot picks it up and generates a fix for it. You might see a response like the following example.
Select Continue. Copilot agent deploys the app successfully. You might see a response like the following example.
If any errors were encountered during the deployment process, Copilot agent mode can also fix the errors and redeploy the application.
Tips
Use Claude 3.5 Sonnet or Claude 3.7 Sonnet for better results.
Make sure the following GitHub Copilot for Azure tools are selected in the GitHub Copilot tools list:
- @azure recommend service config
- @azure check pre-deploy
- @azure AZD Up (Deploy)
- @azure check app status for azd deployment
- @azure config deployment pipeline
- @azure check region availability
- @azure check quota availability
To view a list of tools that are available to your prompts, select the Select tools... button in the chat text box.