Ubuntu-for-Azure-Developers

Setting up your Ubuntu 20.04 developer environment to build Azure solutions

This project is maintained by gloveboxes

Ubuntu 16.04.4 for Azure Developers

Ubuntu for Azure Developers

Author Dave Glover, Microsoft Australia
Platform Ubuntu 18.04 for Azure Developers, Kubuntu 18.04 for Azure Developers, Ubuntu 16.04 for Azure Developers
Date As at May 2018
System Lenovo ThinkPad X1 Carbon Gen 1

This guide assumes you have some experience with Linux and you will open Terminal and Ctrl-Shift-V to paste in Bash commands.

Feel free to contribute to this guide.

Installing the Essentials

Visual Studio Code

Visual Studio Code is a must have IDE, open source, extensible, great language, debugging and tooling support.

Head to Visual Studio Code and download the .deb file for Debian and Ubuntu then install with Software Install.

Visual Studio Extensions

There are a stack of great extensions for Visual Studio Code. These are the ones that I find most useful.

  1. Azure Account, Azure Functions, Azure CLI Tools, Azure Event Hub Explorer, Azure Cosmos DB, Azure IoT Edge, Azure IoT Toolkit, mssql, C#, Docker, Python, C/C++, JSON Tools, Powershell, Azure Application Insights, Azure App Services, Arduino, Azure Resource Manager Tools, Azure Storage, Tools for AI and more…

GitHub Client

When you start Visual Studio Code for the first time you’ll be prompted to install the GitHub client.

sudo apt install git

Before you can commit any changes against GitHub you’ll need to configure who you are.

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

If you are using GitHub two-factor authentication then you’ll need to create a GitHub token that you need to store securely. See Creating a personal access token for the command line for more information. You’ll need to use this token in place of your password when pushing changes to GitHub.

Check out Caching your GitHub password in Git to cache your GitHub credentials so you won’t be asked for your credentials every time you push/sync you repository.

In summary you need to run the following commands. Personally I use a much bigger number than 3600.

git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=3600'

If you are using Visual Studio Team Services then checkout Use Git Credential Managers to Authenticate to VSTS

Installing the latest .NET Core SDK

  1. Install the latest release of the .NET Core SDK

  2. Confirm successful installation of .NET Core SDK

dotnet --version

Azure Storage Explorer

  1. Next Download and Install Storage Explorer. Be sure to select Linux from the drop-down.

  2. The following Bash commands extract the Storage Explorer .tar.gz file to the /opt directory, and add a symbolic link to the StorageExplorer executable.

cd ~/Downloads && \
sudo mkdir -p /opt/StorageExplorer-linux-x64 && \
sudo tar -C $_ -zxvf StorageExplorer-linux-x64.tar.gz && \
sudo ln -s /opt/StorageExplorer-linux-x64/StorageExplorer /usr/bin/StorageExplorer

  1. Create Storage Explorer Ubuntu GNOME/KDE Desktop Resource
mkdir -p ~/.local/share/applications && \
cat > ~/.local/share/applications/StorageExplorer.desktop <<EOL
[Desktop Entry]
Encoding=UTF-8
Name=Storage Explorer
Exec=StorageExplorer
Icon=/opt/StorageExplorer-linux-x64/resources/app/out/app/icon.png
Terminal=false
Type=Application
Categories=Development;
EOL

Notes.

Azure CLI (Command Line Interface)

Notes.

Azure Functions with Visual Studio Code

Code and test Azure Functions locally

Install Azure Functions Core Tools

As at August 2018 see Install the Azure Functions Core Tools

cd ~/Downloads && \
sudo apt install curl -y

curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg

sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-get update

sudo apt-get install azure-functions-core-tools

Toolkit

Docker

Install Docker CE for Ubuntu

It’s useful to add your user sudo rights to Docker. Note, you’ll need to restart your system for this setting to take effect.

sudo usermod <Your User Name> -aG docker

Postman

Download and Install Postman

cd ~/Downloads && \
wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz && \
sudo tar -xzf postman.tar.gz -C /opt && \
rm postman.tar.gz && \
sudo ln -s /opt/Postman/app/Postman /usr/bin/postman

Create Postman Desktop Resource

cat > ~/.local/share/applications/postman.desktop <<EOL
[Desktop Entry]
Encoding=UTF-8
Name=Postman
Exec=postman
Icon=/opt/Postman/app/resources/app/assets/icon.png
Terminal=false
Type=Application
Categories=Development;
EOL

Notes.

Fiddler

See Use Fiddler in Ubuntu

VirtualBox

sudo apt-get install virtualbox

Internet of Things

Azure IoT Hub Explorer

az extension add --name azure-cli-iot-ext

az iot Command Guide

Example IoT Hub command

az iot hub monitor-events --hub-name IotHubName

Notes.

Azure IoT Edge

Building ARM Docker Images from an x64 Ubuntu Host

If you are targeting ARM for your Docker builds then you will need to run the following command before you do your Docker build.

docker run --rm --privileged multiarch/qemu-user-static:register --reset

Notes.

Microsoft SQL Server for Linux

Microsoft SQL Server for Linux (Dockerised)

Install SQL Server and create a database on Ubuntu

Note, deleting a Microsoft SQL Server Docker container will also delete its data. So docker run to download and create and run the docker SQL Container and then use docker stop and start to control.

sudo docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=<YourStrong!Passw0rd>' \
-p 1433:1433 --name sql1 \
-d microsoft/mssql-server-linux:2017-latest

To stop the Microsoft SQL Server Docker container.

docker stop sql1

To start the Microsoft SQL Server Docker container.

docker start sql1

Notes.

Microsoft SQL Server Operations Studio

Follow the notes for Installing Microsoft SQL Operations Studio

Microsoft SQL Server Extension for Visual Studio Code

Use Visual Studio Code to create and run Transact-SQL scripts for SQL Server

Embedded Development

Arduino

Download the Arduino IDE

Fritzing

Download from Fritzing Download Site.

I install in to a non system directory as Fritzing will complain that it doesn’t have access rights to create parts bins.

cd ~/Downloads && \
mkdir -p ~/Apps && \
tar -C $_ -xvjf fritzing-0.9.3b.linux.AMD64.tar.bz2 && \
sudo ln -s ~/Apps/fritzing-0.9.3b.linux.AMD64/Fritzing /usr/bin/fritzing

Create Fritzing Desktop Resource file

cat > ~/.local/share/applications/fritzing.desktop <<EOL
[Desktop Entry]
Version=0.9.3b
Name=Fritzing
GenericName=Fritzing
Comment=Electronic Design Automation software
Exec=fritzing 
Icon=/home/dave/Apps/fritzing-0.9.3b.linux.AMD64/icons/fritzing_icon.png
Terminal=false
Type=Application
Categories=Development;IDE;Electronics;EDA;
X-SuSE-translate=false
StartupNotify=true
Categories=PCB;
MimeType=application/x-fritzing-fz;application/x-fritzing-fzz;application/x-fritzing-fzp;application/x-fritzing-fzpz;application/x-fritzing-fzb;application/x-fritzing-fzbz;application/x-fritzing-fzm;
EOL

Samples

Azure IoT Edge Samples

Hands-on Grove Starter Kit for Azure IoT Edge

Debugging .NET Core apps in Docker Containers from Visual Studio Code on Linux

This is a sample that demonstrates how to use vscode to build and debug dotnet core 2.0 console application in docker container