In this post, I’ll explain how to set an Azure and Docker development environment on the Ubuntu virtual machine we created in Part-1.

Update what's there first

  • Open Terminal and make sure you're up to date.
  • sudo apt-get update
  • sudo apt-get upgrade

 

Install .NET Core 

  •  wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
  • sudo dpkg -i packages-microsoft-prod.deb
  • sudo add-apt-repository universe
  • sudo apt-get install apt-transport-https
  • sudo apt-get update
  • sudo apt-get install dotnet-sdk-2.2

 Reference: https://dotnet.microsoft.com/download/linux-package-manager/ubuntu18-04/sdk-2.2.203

 

Install the Azure CLI 

  • sudo apt install curl
  • sudo curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

 Reference: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-apt?view=azure-cli-latest

 

Install Node and NPM

  • sudo apt install nodejs
  • sudo apt install npm

 

 Install VS Code

Head to https://code.visualstudio.com  and download the .deb file.  The Ubuntu installer will kick in and install Code. 

 

You may have to minimize the browser to see it.

 

Install Azure Data Studio

Head to https://docs.microsoft.com/en-us/sql/azure-data-studio/download?view=sql-server-2017 and download the .deb file.

 

Azure Storage Explorer

Install the dependencies first:

  • sudo apt-get install libgconf-2-4
  • sudo apt install libgnome-keyring-common libgnome-keyring-dev

Head to https://azure.microsoft.com/en-ca/features/storage-explorer and download the archive.  The Archive Manager should kick in.  Click the Extract button.

Create a new folder and extract the files.

 

  

Install Docker

  • sudo apt-get update
  • sudo apt-get install apt-transport-https ca-certificates  
  • curl  gnupg-agent software-properties-common
  • curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  • sudo apt-get install docker-ce docker-ce-cli containerd.io

 If this fails and you get errors, try running:

  • curl -fsSL get.docker.com | CHANNEL=stable sh

 Grant privileges to your account

  • sudo usermod -aG docker $USER
  • Log out and log back in so that your group membership is re-evaluated

Reference: https://docs.docker.com/install/linux/docker-ce/ubuntu/

 

Time to test!

Create a new MVC project:

  • dotnet new mvc -o mymvcapp
  • cd mymvcapp
  • dotnet run
  • Test in a browser

 

Open in Code

  • Type: code .
  • Click on the Startup.cs file, Code will prompt you to install the C# dependencies.
  • Press F5 to debug the project.
  • Click on Add Configuration and select .NET Core Web application
  • Edit the launch.json file to set the correct framework version and DLL name:
  • "program": "${workspaceFolder}/bin/Debug/netcoreapp2.2/mymvcapp.dll"
  • Press F5 again

 

Add Docker support

  • In Code, type: Crl-Shift-p. Type Docker and select Add Docker files to workspace.  Select ASP.NET Core on Linux.
  • Crl-Shift-p. Type Docker Build Image.
  • Crl-Shift-p. Type Docker Run.  Open a browser and navigate to http://localhost

 

Azure Code Extensions

Add the Azure extensions to Code by clicking on the Extensions icon and searching for azure.  Azure Tools does a great job at installing the essential Azure extensions.

There you go, all set up!  Did I miss something?  Make sure to add them in the comments.