GitHub Copilot Agent Mode in Action
GitHub Copilot has significantly shifted the landscape of software development, moving beyond smart code completion to become a more integrated AI partner. One of the most exciting advancements is GitHub Copilot Agent Mode, where Copilot aims to understand and execute more complex tasks based on natural language prompts. But how does this work in a real scenario? To cut through the abstract descriptions, this article dives into a concrete example: I'll share a specific prompt given to GitHub Copilot Agent Mode and analyze the response it generated, offering a practical look at its capabilities and potential impact on developer workflows.
Example: Add Managed Identity Support
Developer: As security enhancement, update Azure deployment, where backend container app authenticates to Azure Postgres using Managed Identity. For local docker deployment, continue to use password based authentication. Ensure necessary changes are applied to code, infra and config.
GitHub Copilot: I'll help you enhance the security of your Azure deployment by configuring the backend container app to authenticate to Azure PostgreSQL using Managed Identity, while preserving password-based authentication for local Docker deployment. Let's start by exploring the codebase to understand the current setup.I'll help you implement secure authentication from your backend container app to Azure PostgreSQL using Managed Identity. Let me explain what I've found and the changes we need to make.
Current Setup
Based on my analysis of your codebase:
Implementation Plan
Here's what we'll need to update:
Let's make these changes one by one.
1. First, let's update the database connection class to support Managed Identity:
## Didn't include the changes to `connection.ts` for brevity.
Made changes.
Now that we've updated the database connection class to support Managed Identity authentication, let's update the environment configuration to support this new authentication mode:
## Didn't include the changes to `env.ts` for brevity.
Made changes.
Now let's update the .env.local file to include the new environment variable:
## Didn't include the changes to `.env.local` for brevity.
Made changes.
Now let's modify the backend.bicep file to assign a managed identity to the backend container app and grant it access to PostgreSQL:
## Didn't include the changes to `bakcend.bicep` for brevity.
Made changes.
Now that we've updated the backend container app to use a managed identity, we need to make sure the PostgreSQL server can accept this type of authentication. Let's update the PostgreSQL server configuration in the main Bicep file to properly support Azure AD authentication.
Recommended by LinkedIn
## Didn't include the changes to `database.bicep` for brevity.
Made changes.
I'll now make sure the docker-compose.yml file for local development is updated to maintain compatibility with the password-based authentication approach. Let's continue implementing our solution for using Managed Identity in Azure and password-based authentication for local Docker development.
The docker-compose.yml looks good as is, since it's already set up for password-based authentication for local development. Now, let's add a new health endpoint to the backend app to make sure our container health checks work properly: I see that the app has a health check endpoint in app.ts but we'll need to expand it to include a separate /api/health endpoint for the container health probes we've configured in our Bicep file. Let's add that endpoint now:
## Didn't include the changes to `database.bicep` for brevity.
Made changes.
Now let's continue enhancing the security of your Finance Tracker application by implementing support for Azure Managed Identity authentication to PostgreSQL.
We've already made several key changes:
Let's now update the deployment script in azure.yaml to ensure our managed identity configurations are properly set up:
## Didn't include the changes to `azure.yaml` for brevity.
Made changes.
Now that we've completed the implementation of Managed Identity authentication for Azure PostgreSQL, let's finalize our solution by updating the container app environment settings in the Azure YAML configuration:
## Didn't include the changes to `azure.yaml` for brevity.
Made changes.
I've implemented all the necessary changes to enhance the security of your Finance Tracker application by enabling Managed Identity authentication for the backend container app to connect to Azure PostgreSQL. Here's a summary of the changes made:
Security Enhancement Implementation
How It Works
Benefits
The next time you deploy using azd up command, the application will use Managed Identity authentication in Azure while continuing to support password authentication for local Docker deployment.
Summary:
In a significant demonstration of its capabilities, the GitHub Copilot Agent operated autonomously to implement changes, showcasing a powerful new paradigm for automated development workflows. Without needing manual intervention, it successfully modified application code, adjusted related configuration files, and updated infrastructure-as-code templates. This highlights its potential to act as a unified coding agent, handling tasks typically requiring both Fullstack and DevOps expertise.
Suleman Kandagal
TLDR? Listen to the audio overview here... https://on.soundcloud.com/NNfQdZruEPdeYiu77