Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Install .NET Core in Linux using Azure Batch Start Task

  • Follow this link to create a shell Script and name it as for ex-

    Note : The above link is valid for Ubuntu 16.04 version, hence the script can change depending up the Linux distro where you want to install the .NET Core. Please select the required Linux distribution and create the script accordingly.
  • Upload the script to the storage account from where start task will be downloaded in the Linux VM.

  • Create a BatchPool consisting of required Linux VM distro and edit the Start Task as shown below. I have used BatchLabs tool to simulate the scenario, same thing holds true in case the pool is Created from portal as well.

    Blob source : - This represents the actual URL of the blob (i.e the script).
    File path : /mnt/batch/tasks/startup/wd - This represents the local path in Linux VM where the script will be downloaded from storage account.

    Create Azure Batch Start Task

  • The above two steps works as expected when you have created the script from a Linux environment. The same steps fails with the below error when you create the script in windows environment and upload to storage account.

    (--install):rocessing archive packages-microsoft-prod.deb

    cannot access archive: No such file or directory

    Errors were encountered while processing:


    ] is not understood in combination with the other options.

    ] is not understood in combination with the other options.

    Reading package lists... Done

    Building dependency tree

    Reading state information... Done

    E: Unable to locate package dotnet-sdk-2.1.200

    E: Couldn't find any package by glob 'dotnet-sdk-2.1.200'

    E: Couldn't find any package by regex 'dotnet-sdk-2.1.200'

    The reason being, the script in different environments (Windows / Linux) are created in different formats. The way you can figure out that is by running file command in Linux bash shell. Unix systems use a single character -- the linefeed -- and Windows systems use both a carriage return and a linefeed (often referred to as "CRLF") to terminate lines in text files.

    Refer :

    $ file                                                                           ////  Script created in Windows and uploaded to storage account ASCII text, with CRLF line terminators

    $ file                                                             ////  Script created in Linux and uploaded to storage account ASCII text

  • Hence to prevent the above file format mismatch, we can follow either of the below steps:

    • Create the script in a different Ubuntu box and upload to the script to the storage explorer using storage explorer for linux.
    • If you don’t have storage explorer in linux environment, get the script from the VM created in the previous step to your windows box using the below Putty command. Putty tool comes with the below executable pscp.exe

Get the script from the VM using pscp.exe

Once you have retrieved the file from Linux to Windows, upload the file to the storage account as it is.

    • You can also automate the process of converting files from Windows (DOS) to Unix format to save yourself a little trouble using the command.

      $ dos2unix

        However to execute the above command you need to first install the package dos2unix using the command : sudo apt-get install dos2unix

Share the post

Install .NET Core in Linux using Azure Batch Start Task


Subscribe to Msdn Blogs | Get The Latest Information, Insights, Announcements, And News From Microsoft Experts And Developers In The Msdn Blogs.

Get updates delivered right to your inbox!

Thank you for your subscription