With Visual Studio Online, you get a fully managed development environment in the cloud on demand. Recently they announced that you can also register your own machine and access it remotely through Visual Studio Code or the Visual Studio Online Web Editor.
Why would you want to do that?
Microsoft mentions the following reasons:
This is a great option for developers that want to cloud-connect an already configured work or home machine for anywhere access, or take advantage of the Visual Studio Online developer experience for specialized hardware we don’t currently support.
Let’s try it!
First make sure that you have an existing development plan:
- Go to https://online.visual.studio.com and click on Get Started>
- Login using your company or Microsoft account
- Check the top bar.
- You have an existing plan? Great you can skip to the next step.
- You don’t have an existing plan? Let’s continue…
- Click on the Create environment button
- The Create a new billing plan window appears. Enter the necessary details.
- Click on Create. Now the Create an Enviroment window appears.
- As we want to use our own machine, we can skip this step. Just click Cancel.
Now it’s time to register our machine through the CLI. First we have to download and install the CLI:
- On Windows:
- Install via
Powershell
by download and executing our script. - On macOS:
brew install microsoft/vsonline/vso
On Linux:
apt install vso
Once the CLI is installed, run ‘VSO start’. During the process, you will be asked to login through your browser.
[2020-04-17 07:09:30.147 CLI I] vso v1.0.2005.59801 (pid: 22936)
[2020-04-17 07:09:30.454 CLI I] Authenticating...
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code <CODE> to authenticate.
Would you like to run as a persistent service/daemon? [Y/n]: n
[2020-04-17 07:10:18.108 CLI I] Will run as a process
[2020-04-17 07:10:18.623 CLI I] A VSO plan is required to register your environment.
[2020-04-17 07:10:18.627 CLI I] Using VSO plan: /subscriptions/<subscriptionid>/resourceGroups/vso-rg-a7ff597/providers/Microsoft.VSOnline/plans/vso-plan-westeurope
Enter an environment name or blank to use [<MachineName>]:
[2020-04-17 07:10:27.634 CLI I] Creating your environment...
[2020-04-17 07:10:29.153 CLI I] Saving local configurations...
[2020-04-17 07:10:29.321 CLI I] Authenticating...
[2020-04-17 07:10:31.936 CLI I] Waiting for environment to become available...
[2020-04-17 07:10:38.483 CLI I] All done! Connect: https://online.visualstudio.com/environment/<environmentid>
Now if you open up Visual Studio Online, you should see your own machine:
To remove your machine again, you can use ‘VSO stop’:
[2020-04-17 07:33:47.818 CLI I] vso v1.0.2005.59801 (pid: 8792)
Shared workspace not found: True
[2020-04-17 07:33:48.524 CLI I] Authenticating...
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code <CODE> to authenticate.
[2020-04-17 07:34:34.313 CLI I] Authentication successful. Removing your environment.
[2020-04-17 07:34:35.340 CLI I] Sucessfully removed your local environment.