Docker sandbox via SSH in VS Code for BC development
Running your coding agents in a TUI (Terminal User Interface) can feel very fast and convenient. At the same time, it can also be nice to have the full files ready, which makes it helpful to integrate your coding agent into your development environment. In my recent blog posts (1, 2, and 3), I have always shown TUIs because that was the only way with Docker Sandboxes. But that has now changed, because you can access your Sandbox via SSH, which opens up other options.
The TL;DR
Connecting to a development environment via SSH is not particularly new; VS Code has been able to do that for a long time, as explained in the official docs. Two years ago, I already shared two blog posts (1 and 2) describing how I use that in my preferred dev setup. The change now is that you can also use it for your Sandbox. The same security boundaries, networking monitoring, and credential injection are already conveniently available via an SSH connection. This is what it looks like:
Pretty neat, right?
The details
To be honest, the details are sparse, but to walk you through them: first, you need to set up the SSH functionality via sbx setup ssh. This configures SSH functionality for Sandboxes in general (also explained in the official docs). Note that if you are not sure whether you have done that in the past, you can always just re-run it without breaking anything.
The next step is to connect to the Sandbox via SSH. That requires an existing (but not necessarily running) Sandbox. Building on top of the recent blog posts mentioned above, I use sbx run --kit .\al\ copilot . to create a GitHub Copilot Sandbox with the “AL” mixin for Business Central development. I can then connect to it from VS Code. Note that in this case, the Sandbox is already running, but if it had been stopped, it would automatically have been started when the SSH request came in.
In the video, I had already selected the workspace within the Sandbox, but if you do that for the very first time, you also need to select that folder. The last step is then to start the agent you want to use which in my case is Copilot. After that, everything works as if you were using the Sandbox directly in the terminal, as you can also see in the demo video: I can interact with the Business Central backend without authentication because of the amazing credential injection feature of Docker Sandboxes.
Webmentions:
No webmentions were found.
No likes were found.
No reposts were found.
.png)