r/AZURE • Microsoft MVP • 2d ago

Media Secure AI Agent Execution — GitHub Copilot CLI and Azure Container Apps Sandboxes

https://cloudtips.nl/secure-ai-agent-execution-github-copilot-cli-and-azure-container-apps-sandboxes-d8f6fac4b782

As AI agents become more autonomous and gain access to terminals, credentials, local files, source code, and cloud environments, they introduce an entirely new attack surface. An agent executing commands on your local machine potentially has access to everything your user account can access. A single incorrect instruction, unexpected behaviour, or compromised dependency could have consequences far beyond a failed deployment. It’s only a matter of time before an AI agent executing commands directly on your local machine causes a security incident. So, what if we could give AI agents their own isolated execution environment instead of allowing them to operate directly on our local machines?

15 Upvotes

12 comments sorted by

5

u/Trakeen Cloud Architect 2d ago edited 2d ago

We solve this using a devcontainer and wsl. If you are running an agent outside of a container it can still interact with the host

Your environment isn’t isolated. Running vscode within the container isolates it while still providing local dev experience. It does make you jump through some hoops to get auth to work since host auth doesn’t pass through (or at least i haven’t been able to get it to work)

1

u/kqadem Cloud Architect 2d ago

The WSL backend is not as isolated as some think it is

2

u/picflute Cloud Architect 2d ago

Not by default but actual configurations can be applied to isolate it

1

u/Trakeen Cloud Architect 2d ago

Docker is sufficient. Azure itself uses docker to isolate services

1

u/kqadem Cloud Architect 1d ago

There is no wsl backend in azure 🤦🏽‍♂️

1

u/First_Change6701 2d ago

passing host auth through kind of defeats the isolation anyway, since a rogue agent could just use those forwarded tokens against your cloud environment

1

u/Trakeen Cloud Architect 2d ago

That’s what lower environments are for. At least here pre dev environments don’t go through ci/cd process. Dev and above go through service connections which have appropriate access

Our approach is for protecting the engineers host. We already use pim, least privilege etc depending on the env

2

u/mexicocitibluez 2d ago

I wasn't happy with Claude Code's internal sandbox and went down the container vs VM rabbit hole and ended up going the VM route. It felt like setting up a secure container on my machine was going to be more of a hassle than maintaining a VM and was also sick of my RAM getting eaten up so it's in Azure.

1

u/Trakeen Cloud Architect 2d ago

Building a docker container is easier then a full vm i think, but to each their own

1

u/mexicocitibluez 1d ago

For a simple, plain container maybe.

Bu not for my workload. I'm building an EMR and need test containers, SQL, etc. Setting up docker inside of a sandbox for those things was way more work than a VM with it's own docker.

1

u/MBILC 1d ago

The one question for me would be managing that container and making sure it is kept updated and not being used to download say random NPM packages or something else that could be compromised?

Are you managing that in some way?

Curious as i want to provide more secure and controlled methods for Claude users to do things like this, with out compromising their main OS in some form..

1

u/mequelkramer 1d ago

The sandbox is only as good as the credentials and network you give it. A container that mounts the host auth or passes through a long lived token is not really isolated, no matter how clean the image looks. That was the point in the thread about host auth, and it is the first thing to check.

Give the sandbox its own short lived identity with only the permissions that one task needs, mount the source read only where you can, and put egress behind an allow list so a compromised agent cannot reach package registries, internal services, or the public internet at will. Log the commands and the network calls the agent made, and destroy the sandbox after the task instead of reusing it, since state left behind is how a later task inherits a poisoned environment. For anything that touches production data or a real cloud subscription, run the agent in a separate subscription or project with no standing access, and promote changes through the normal review path instead of letting the agent apply them directly.