Microsoft is serious about “We really don’t care about which device an end user wants to use”. Check out some of the news articles of the last few weeks:

  1. Visual Studio to be available on MAC which means users now have a complete IDE for everything mobile , cloud and MAC Development.
  2. If you are not it using already, Visual Studio Code for all the 3 major desktop flavours Windows, Linux and Mac
  3. Microsoft fortifies its commitment to Open Source by becoming a Platinum member for Linux Foundation
  4. Build, deploy and support Azure deployments from Ubuntu and Mac. I will cover the Ubuntu steps in this post.
  5. SQL Server on Linux . Will cover this in a post shortly.

But why?

Well one of the reasons, is that I use a mix of OS on my devices. But until recently, anything to do with Azure Management, I had to run to a Windows machine to sort that part out. Not anymore. This also gives me the benefit of sharing Azure capability with customers and colleagues who use a Mac or Linux based workstation. This also gives the ability of PowerShell core to be available on these devices as well and users being able to build, deploy and manage Azure RM deployments. No need to rewrite any scripts.

Let’s get right into it

  1. Installing .NET Core
    1
    2
    3
    4
    5
    6
    7
    sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list'

    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893

    sudo apt-get update

    sudo apt-get install dotnet-dev-1.0.0-preview2.1-003177 -y
  2. Installing PowerShell Core 6.11
    1
    2
    3
    4
    5
    wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.11/powershell_6.0.0-alpha.11-1ubuntu1.16.04.1_amd64.deb

    sudo dpkg -i powershell_6.0.0-alpha.11-1ubuntu1.16.04.1_amd64.deb

    sudo apt-get install -f –y
    Installing Azure RM .NET Core Preview Module
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    powershell Install-Module AzureRM.NetCore.Preview

    powershell Import-Module AzureRM.NetCore.Preview

    if [[ $? -eq 0 ]]

    then

    echo "Successfully installed PowerShell Core with AzureRM NetCore Preview Module."

    else

    echo "PowerShell Core with AzureRM NetCore Preview Module did not install successfully." >&2

    fi
    Installing Azure CLI
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    read -p "Do you want to install Azure CLI? y/n" -n 1 -r

    echo # (optional) move to a new line

    if [[ $REPLY =~ ^[Yy]$ ]]

    then

    sudo apt-get install node.js npm -y

    sudo npm install -g azure-cli

    sudo ln -s /usr/bin/nodejs /usr/bin/node

    if [[ $? -eq 0 ]]

    then

    echo "Successfully installed Azure CLI."

    else

    echo "Azure CLI not installed successfully." >&2

    fi

    else

    echo "You chose not to install Azure CLI. Exiting now."

    fi

    To make things simple download this script and run it from a terminal or directly from Visual Studio Code 🙂 – deployazurermcoreonubu1604-sh

    Complete Script

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    #!/bin/bash

    #.NET Core Install

    sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list'

    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893

    sudo apt-get update

    sudo apt-get install dotnet-dev-1.0.0-preview2.1-003177 -y

    #PowerShell Core 6.11

    wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.11/powershell_6.0.0-alpha.11-1ubuntu1.16.04.1_amd64.deb

    sudo dpkg -i powershell_6.0.0-alpha.11-1ubuntu1.16.04.1_amd64.deb

    sudo apt-get install -f -y

    #Azure RM NetCore Preview Module Install

    powershell Install-Module AzureRM.NetCore.Preview

    powershell Import-Module AzureRM.NetCore.Preview

    if [[ $? -eq 0 ]]

    then

    echo "Successfully installed PowerShell Core with AzureRM NetCore Preview Module."

    else

    echo "PowerShell Core with AzureRM NetCore Preview Module did not install successfully." >&2

    fi

    #Install Azure CLI

    #Address https://azure.microsoft.com/en-us/documentation/articles/xplat-cli-install/

    read -p "Do you want to install Azure CLI? y/n" -n 1 -r

    echo # (optional) move to a new line

    if [[ $REPLY =~ ^[Yy]$ ]]

    then

    sudo apt-get install node.js npm -y

    sudo npm install -g azure-cli

    sudo ln -s /usr/bin/nodejs /usr/bin/node

    if [[ $? -eq 0 ]]

    then

    echo "Successfully installed Azure CLI."

    else

    echo "Azure CLI not installed successfully." >&2

    fi

    else

    echo "You chose not to install Azure CLI. Exiting now."

    fi

    The above screenshot shows PowerShell running from a Terminal session on Ubuntu 16.04. Excited much??

    Cheers