Uncategorized

Configuring Visual Studio Code for WVD

Hey everyone. In this post I am going to show you how to install Visual Studio Code, install the Azure plugin and then connect to our WVD environment and run some basic commands. So let’s get started!

Installing Visual Studio Code

First of all we need to download Visual Studio Code from here – https://code.visualstudio.com/

Once you have downloaded and installed it you should see the screen as per below

The first thing we need to do is to install Nodes.JS which you can download from here. What is Node.js? Well its described as: “An open-source, cross-platform, JavaScript runtime environment that executes JavaScript code outside a web browser.”

Node.js is a pre-requisite for the Azure Plug in which we need to install.

During the install you will be asked if you want to install the build tools, I opted to do so. This will also install some other components via Chocolatey

Install Azure Account plug-in

OK now that we have the pre-reqs installed we can proceed and install the required plug-ins. The plugin we need to install is called “Azure Account” You can find more details on the plugin here – https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account

The plugin allows the following commands:

Command
Azure: Sign InSign in to your Azure subscription.
Azure: Sign In with Device CodeSign in to your Azure subscription with a device code. Use this in setups where the Sign In command does not work.
Azure: Sign In to Azure CloudSign in to your Azure subscription in one of the sovereign clouds.
Azure: Sign OutSign out of your Azure subscription.
Azure: Select SubscriptionsPick the set of subscriptions you want to work with. Extensions should respect this list and only show resources within the filtered subscriptions.
Azure: Create an AccountIf you don’t have an Azure Account, you can sign up for one today and receive $200 in free credits.
Azure: Open Bash in Cloud Shell1Open a new terminal running Bash in Cloud Shell.
Azure: Open PowerShell in Cloud Shell1Open a new terminal running PowerShell in Cloud Shell.
Azure: Upload to Cloud Shell1Upload a file to your Cloud Shell storage account

So now we have our plugin installed, its time to give it a try. Straight away I hit a snag. My account has access to multiple subscriptions and directories, and with this plugin there is no option to select a different directory. I have shown an example if this below:

Editing the package.json file

Luckily, the fix is quite simple. If you edit the file package.json the directory C:\Users\user.vscode\extensions\ms-vscode.azure-account-0.9.3 you can enter your default subscriptionID in the azure.tenant section

What this means is, that you will not be prompted, it will just sign you straight into the tenant without prompting. You can see a demo of this below.

As you can tell, straight from Visual Studio Code, we can sign into Azure, and then run some basic WVD cmdlets against our subscription using the Cloud Shell.

In the next post, we will explore the cmdlets a bit more.

Thanks for reading and watching!

Leave a Reply

Your email address will not be published. Required fields are marked *