Tag: WSL

Download the new Windows Terminal Preview

Download the new Windows Terminal (Preview)

At Microsoft Build 2019, the team announced a new Windows Terminal which will be open-source. There are a couple of improvements which are coming to the new Windows Terminal like; multiple tabs support, GPU accelerated DirectWrite/DirectX-based text rendering engine, advanced configuration settings, and much more. It allows you to run different shells like Windows PowerShell, PowerShell Core, Command Prompt, WSL, and also WSL 2. Today you can download the Windows Terminal Preview from the Microsoft Store. It is still a very early preview and the team, as well as the community, are still working on it. The team’s goal is to work with the community and launch Windows Terminal 1.0 end of 2019.

Windows Terminal is a new, modern, fast, efficient, powerful, and productive terminal application for users of command-line tools and shells like Command Prompt, PowerShell, and WSL.

You can find more information about it here on the Microsoft announcement blog.

Download Windows Terminal

You were able to download the sources for the terminal from GitHub and build it yourself. However, the preview release in the Windows Store makes it much easier to try it out and stay more up to date.

Windows Terminal

Windows Terminal will be delivered via the Microsoft Store in Windows 10 and will be updated regularly, ensuring you are always up to date and able to enjoy the newest features and latest improvements with minimum effort.

Provide Feedback and get involved

Windows Terminal is a new, modern, feature-rich, productive terminal application for command-line users. It includes many of the features most frequently requested by the Windows command-line community including support for tabs, rich text, globalization, configurability, theming & styling, and more.

The Terminal will also need to meet our goals and measures to ensure it remains fast, and efficient, and doesn’t consume vast amounts of memory or power.

You can file bugs and share feedback with the community and us, as well as fix issues and make improvements on GitHub. If you come across any bugs or want to share feedback, you can do that on GitHub issues for detailed issues/discussions or with the Microsoft Store release in the Feedback Hub. You join the development on GitHub.

Try out the Windows Terminal today, and if you have any questions, please let me know in the comments.



Install WSL 2 on Windows 10

With the Windows 10 Insider Preview Build 18917, the team also ships the first version of the Windows Subsystem for Linux 2 (WSL 2), which was announced at the Microsoft Build 2019 conference. In this post, I am going to show you how you can install WSL 2 on your Windows 10 machine.

The Windows Subsystem for Linux (WSL 1) was in Windows 10 for a while now and allowed you to use different Linux distros directly from your Windows 10 machine. With WSL 2, the architecture will change drastically and will bring increased file system performance and full system call compatibility. WSL 2 is now using virtualization technology (based on Hyper-V) and uses a lightweight utility VM on a real Linux kernel. You can find out more about WSL 2 in the release blog or on the Microsoft Docs Page for WSL 2.

WSL 2 Architecture

Requirements

To install WSL 2, you will need the following requirements:

Install WSL 2

To install the Windows Subsystem for Linux 2 (WSL 2), you need to follow these tasks.

  • Enable the Windows Subsystem for Linux Optional feature (WSL 1 and WSL 2)
  • Install a distro for the Windows Subsystem for Linux
  • Enable the ‘Virtual Machine Platform’ optional feature (WSL 2)
  • Configure the distro to use WSL 2

Enable the Windows Subsystem for Linux

To run the WSL on Windows 10 you will need to install the optional feature:

 
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Install a Linux distro for the Windows Subsystem for Linux

If you don’t already have installed a WSL distro, you can download and install it from the Windows 10 store. You can find more here: Crazy times – You can now run Linux on Windows 10 from the Windows Store

Enable the Virtual Machine Platform feature

WSL 2 Enable Virtual Machine Platform

WSL 2 Enable Virtual Machine Platform

To make use of the virtualization feature for WSL 2, you will need to enable the optional Windows feature. You can run the following PowerShell command to do this. You will need to start PowerShell as an Administrator. After you run this command, you might need a restart of your computer.

 
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform

Set WSL distro to use version 2

After you completed the first two steps, you will need to configure the distro to use WSL 2. Run the following command to list the available distros in PowerShell:

 
wsl -l -v

To set a distro to WSL 2 you can run the following command:

 
wsl --set-version DistroName 2

You can also set WSL 2 as the default:

 
wsl --set-default-version 2

To find out more about installing WSL 2, check out the Microsoft Docs page.

If you are now running your distro using WSL 2, you can now see that there is a Virtual Machine worker process running and if you search a little bit more, you can also find the VHDX file of the distro.

WSL 2 VHDX file

I hope this helps you and gives you a quick overview, if you have any questions, let me know in the comments and check out the WSL 2 FAQ.



WLinux WSL Setup Wizard for Windows 10

WLinux – The best WSL for Windows 10

A couple of Windows 10 releases back, Microsoft delivered the Windows Subsystem for Linux. The Windows Subsystem for Linux allows you to run Linux distros, like Ubuntu, Debian, Suse, and others, on Windows 10. Around the Microsoft Ignite 2018 timeframe, another distro was released to the Windows Store called WLinux. WLinux is a Linux environment for Windows 10 built on work by Microsoft Research and the Debian project. WLinux is a custom Linux distro built from Debian specifically for use on the WSL. While other distros are available for WSL, WLinux is the first optimized for use by users of WSL for WSL. It helps developer run Linux tooling on Windows and integrates into perfectly into Windows.

With the latest Windows 10 Insider builds, you can also run the Windows Subsystem for Linux 2 (WSL 2).

WLinux Setup

WLinux WSL Setup Wizard for Windows 10

WLinux comes with a custom setup to prepare your environment in a straightforward and easy wizard. It lets you set up some predefined software and settings and configure integration into Windows.

WLinux WSL Docker Bridge to Windows

WLinux Docker Bridge

If you want to run Docker in the Windows Subsystem for Linux, you can bring the Docker Client to the Windows Docker Engine. This allows you to run Docker directly from WSL and PowerShell at the same time.

Microsoft Tooling

WLinux Installing Azure CLI

Of course, WLinux brings the usual Linux development tools and easy setup for Ruby, NodeJS, Go, Java, Python, editors like emacs and even different shells. You can also easily add Microsoft tooling by adding Azure CLI, PowerShell Core, and even Visual Studio Code.

Windows Explorer Integration and WSL Utilities (wslu)

It easily lets you set up Windows Explorer integration and brings wslu, a collection of utilities for WSL, preinstalled. Wslu brings the following features to the WSL

  • wslusc This is a WSL shortcut creator to create a shortcut on your Windows 10 Desktop.
  • wslsys This is a WSL system information printer to print out some basic system information.
  • wslfetch This is a WSL Screenshot Information Tool to print information elegantly.
  • wslupath This is a WSL Windows path Converter that can convert Windows path to other styles of path.
  • wslview This is a fake WSL browser that can help you open link in default Windows browser.

WSLfetch

If you want to know more about WLinux, check out the website Whitewater Foundry.

Or download WLinux from the Microsoft Store.

You can also contribute to the project on GitHub.



Ubuntu on Windows Server using WSL

Install Windows Subsystem for Linux on Windows Server

In 2017 Microsoft made it possible to run different Linux distribution on Windows 10, using a feature called the “Windows Subsystem for Linux“. With the latest official Semi-Annual Channel Windows Server release called Windows Server, version 1709 Microsoft also allowed to run the Windows Subsystem for Linux (WSL) on Windows Server. With the next release of Windows Server called Windows Server, version 1803, Microsoft will also add some improvements to the Windows Subsystem on Linux, which also apply to Windows 10 as well as Windows Server. This blog post shows you how you can do this.

First, you have a Windows Server, version 1709 running. After that enable the Microsoft Windows Subsystem for Linux feature, running the following command (This will need a reboot)

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

You can download the appx packages for your favorite Linux distribution; this can be today:

  • Ubuntu
  • OpenSUSE
  • Suse Linux Enterprise Server

If you are running on Windows Server Core (which is highly likely), you can use the following command to download the Linux distributions.

# For Ubuntu 16.04
 
Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1604 -OutFile ~/Ubuntu.zip -UseBasicParsing
 
# For Ubuntu 18.04
 
Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1804 -OutFile ~/Ubuntu1804.zip -UseBasicParsing
 
# For OpenSUSE 42
 
Invoke-WebRequest -Uri https://aka.ms/wsl-opensuse-42 -OutFile ~/OpenSUSE.zip -UseBasicParsing
 
# For SLES 12
 
Invoke-WebRequest -Uri https://aka.ms/wsl-sles-12 -OutFile ~/SLES.zip -UseBasicParsing

You can then unpack the file:

Expand-Archive ~/Ubuntu.zip C:\Distros\Ubuntu

Now you can open that folder and run the installer, for example ubuntu.exe. The first time this will do the setup where you also define the UNIX username and password as well as the root password.

WSL on Windows Server

After that, you can run updates for your distro, and you can start using Linux.

If you want to know more about the WSL, check out the Microsoft Documentation: Windows Subsystem for Linux Documentation and have a look at my WSL post in for Windows 10: Crazy times – You can now run Linux on Windows 10 from the Windows Store

You can also find the other Linux distro packages here: WSL distro packages.



Hyper-V HVC SSH Direct for Linux VMs

HVC – SSH Direct for Linux VMs on Hyper-V

If you are running Hyper-V on Windows 10 or Windows Server 2016, you probably know about a feature called PowerShell Direct. I also mentioned that PowerShell Direct is one of the 10 hidden features in Hyper-V you should know about. PowerShell Direct lets you remotely connect to a Windows Virtual Machine running on a Hyper-V host, without any network connection inside the VM. PowerShell Direct uses the Hyper-V VMBus to connect inside the Virtual Machine. Of course, this feature is convenient if you need it for automation and configuration for Virtual Machines. As this is great for Windows virtual machines, it does not work with Virtual Machines running Linux. In the latest Windows 10, Windows Server 1803 (RS4) and Windows Server 2019 (RS5) Insider Preview builds, Microsoft enabled a tool called HVC. HVC is a tool which allows you to do some command line VM management. HVC SSH is basically PowerShell Direct for Linux VMs.

This allows connecting to a Linux VM using SSH over the Hyper-V VMBus. You are also able to copy files inside a virtual machine using scp, similar to Copy-item -ToSession using PowerShell Direct. You can read more about PowerShell Direct on my blog or the Microsoft Doc pages.

How to connect to Linux VMs using SSH Direct

HVC SSH on Hyper-V

To connect to Linux VMs using SSH Direct (HVC) type hvc.exe into the command line or PowerShell. This will give you all the possible command options. Of course, SSH has to big configured inside the Linux virtual machine.

hvc ssh Thomas@VMNAME

To make this work, the SSH server inside the VM needs to be configured.

Final Thoughts

A pretty cool tool which will be available in the official releases of Windows 10 and Windows Server 1803, released this spring. Later this year this feature will also be included in Windows Server 2019. If you want to try it out today, give the Windows Insider Preview builds a spin.

Thanks to Ben Armstrong for pointing this out 😉



Azure Stack Tools

Setup an Azure Stack Cloud Operator and Developer Workstation Environment

If you are responsable to manage and operate Azure Stack, you will need to enable a couple of tools to manage Azure Stack. This post should give you a summary of what you should do to setup your Azure Stack Operator and Developer workstation environment.

Operating System

Azure Stack Windows Admin Workstation

First of all you should setup a clean base system. I usually use the latest version of Windows 10, right now the latest Windows 10 version is the Fall Creators Update which give you some great features like the OpenSSH client or the Windows Subsystem for Linux build in, or I use Winodws Sevrer 2016 with Desktop Expierence. Make sure you install all the latest updates for Microsoft Update.

Install Visual Studio Code

PowerShell for Visual Studio Code

Visual Studio Code is a new, free, lightweight cross-platform code editor for building modern web and cloud applications on Mac OS X, Linux and Windows. It is perfect for editing JSON files and even writing some code. And it has a built-in Terminal so you don’t have to switch between different windows.

I recommend you install the following Extensions:

 
code --install-extension ms-vscode.vscode-azureextensionpack
code --install-extension ms-vscode.powershell
 
code --list-extensions

Install SSH Client or Windows Subsystem for Linux (WSL)

OpenSSH Windows 10

To manage Linux Virtual Machines running on Azure Stack or if you need to manage the hardware switches in Azure Stack or your border switches where Azure Stack is connected, SSH is the way to access it. Windows 10 now comes with several builtin options like the OpenSSH Client which you can install as addtional feature or for example the Windows Subsystem for Linux (WSL) which allows you to run several linux tools on Windows directly. If you are using another version of Winodws, the thrid party application PuTTY is your friend.

You can also using PowerShell to install it:

 
Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'
 
# Install the OpenSSH Client
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
 
# Install the OpenSSH Server
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

Install Azure Stack PowerShell

Install Azure Stack PowerShell

Azure Stack compatible Azure PowerShell modules are required to work with Azure Stack. PowerShell commands for Azure Stack are installed through the PowerShell gallery, you can run the following commands to install it: (Make sure there are no other Azure PowerShell Modules installed, if there are, the commands will remove them). If you also install Visual Studio, install Visual Studio first before you install the Azure Stack PowerShell.

 
# Trust the PowerShell Gallery
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
 
# Remove Existing Azure PowerShell Modules
Get-Module -ListAvailable | where-Object {$_.Name -like “Azure*} | Uninstall-Module
 
# Install the AzureRM.Bootstrapper module. Select Yes when prompted to install NuGet
Install-Module -Name AzureRm.BootStrapper
 
# Install and import the API Version Profile required by Azure Stack into the current PowerShell session.
Use-AzureRmProfile -Profile 2017-03-09-profile -Force
 
#Install Azure Stack Module
Install-Module -Name AzureStack -RequiredVersion 1.2.11
 
# Verify Installation
Get-Module -ListAvailable | where-Object {$_.Name -like "Azure*"}

If you need to install it on a machine which does not have access to the internet. check outthe offical Microsoft page: Install PowerShell for Azure Stack

Install Azure Stack tools

Azure Stack Tools

AzureStack-Tools is a GitHub repository that hosts PowerShell modules that you can use to manage and deploy resources to Azure Stack. This brings you several functionalities for Azure Stack management:

  • Deployment of Azure Stack – Helps prepare for Azure Stack deployment.
  • Resource Manager policy for Azure Stack – Constrains Azure subscription to the capabilities available in the Azure Stack.
  • Connecting to Azure Stack – Connect to an Azure Stack instance from your personal computer/laptop.
  • Setting up Identity for Azure Stack – Create and manage identity related objects and configurations for Azure Stack
  • Azure Stack Service Administration – Manage plans and subscriptions in Azure Stack.
  • Azure Stack Compute Administration – Manage compute (VM) service in Azure Stack.
  • AzureRM Template validator – Validate Azure ARM Template Capabilities
  • Azure Stack Infrastructure Administration – Manage Azure Stack Infrastructure

You can get the Azure Stack tools from GitHub:

 
# Change directory to the root directory
cd \
 
# Download the tools archive
Invoke-WebRequest https://github.com/Azure/AzureStack-Tools/archive/master.zip -OutFile master.zip
 
# Expand the downloaded files
Expand-Archive master.zip -DestinationPath . -Force
 
# Change to the tools directory
cd AzureStack-Tools-master

You can directly open that folder in Visual Studio Code:

 
code C:\AzureStack-Tools-master

Configure Azure Stack PowerShell environment

As an Azure Stack user, you can configure your Azure Stack PowerShell environment. After you configure, you can use PowerShell to manage Azure Stack resources such as subscribe to offers, create virtual machines, deploy Azure Resource Manager templates, etc.

For an Azure Stack deployment which is using Azure Active Directory (AAD) as an Identity provider, you can use the following commands:

 
# Navigate to the downloaded folder and import the **Connect** PowerShell module
Set-ExecutionPolicy RemoteSigned
Import-Module .\Connect\AzureStack.Connect.psm1
 
# For Azure Stack development kit, this value is set to https://management.local.azurestack.external. For a real Azure Stack solution this will be https://maangement.-region-.-fqdn-
$ArmEndpoint = "<Resource Manager endpoint for your environment>"
 
# For Azure Stack development kit, this value is set to https://graph.windows.net/.
$GraphAudience = "<GraphAudience endpoint for your environment>"
 
# Register an AzureRM environment that targets your Azure Stack instance
Add-AzureRMEnvironment `
-Name "AzureStackUser" `
-ArmEndpoint $ArmEndpoint
 
# Set the GraphEndpointResourceId value
Set-AzureRmEnvironment `
-Name "AzureStackUser" `
-GraphAudience $GraphAudience
 
# Get the Active Directory tenantId that is used to deploy Azure Stack
$TenantID = Get-AzsDirectoryTenantId `
-AADTenantName "<myDirectoryTenantName>.onmicrosoft.com" `
-EnvironmentName "AzureStackUser"
 
# Sign in to your environment
Login-AzureRmAccount `
-EnvironmentName "AzureStackUser" `
-TenantId $TenantID

Install and configure CLI for use with Azure Stack

Azure CLI

You can also use the Azure CLI 2.0 to manage Azure Stack.

Install Azure CLI on Windows using MSI

To install the CLI on Windows and use it in the Windows command-line, download and run the Azure CLI Installer (MSI).

Install with apt-get for Bash on Ubuntu on Windows (WSL)

  1. Open the Bash shell.
  2. Modify your sources list.
    echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ wheezy main" | \
    sudo tee /etc/apt/sources.list.d/azure-cli.list
  3. Run the following sudo commands:
    sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 52E16F86FEE04B979B07E28DB02C46DF417A0893
    sudo apt-get install apt-transport-https
    sudo apt-get update && sudo apt-get install azure-cli
  4. Run the CLI from the command prompt with the az command.

Connect to Azure Stack using the Azure CLI

If you are using Public Certificates for your Azure Stack, this is pretty staight forward, if you are using the Azure Stack Development Kit or an Internal CA, make sure your client trusts the Azure Stack CA root Certificate. You can find more here: Install and configure CLI for use with Azure Stack

Register your Azure Stack environment by running the az cloud register command.

Register as a cloud administrative environement:

  1. To register the cloud administrative environment, use:
    az cloud register \
    -n AzureStackAdmin \
    --endpoint-resource-manager "https://adminmanagement.-region-.FQDN-" \
    --suffix-storage-endpoint "-region-.FQDN-" \
    --suffix-keyvault-dns ".adminvault.-region-.FQDN-" \
    --endpoint-active-directory-graph-resource-id "https://graph.windows.net/" \
    --endpoint-vm-image-alias-doc <URI of the document which contains virtual machine image aliases>
  2. Set the active environment by using the following commands.
    az cloud set \
    -n AzureStackAdmin
  3. Update your environment configuration to use the Azure Stack specific API version profile. To update the configuration, run the following command:
    az cloud update \
    --profile 2017-03-09-profile
  4. Sign in to your Azure Stack environment by using the az login command. You can sign in to the Azure Stack environment either as a user or as a service principal.
    az login \
    -u <Active directory global administrator or user account. For example: username@<aadtenant>.onmicrosoft.com> \
    --tenant <Azure Active Directory Tenant name. For example: myazurestack.onmicrosoft.com>

Register the user environment, use:

  1. To register the user environment, use:
    az cloud register \
    -n AzureStackUser \
    --endpoint-resource-manager "https://management.local.azurestack.external" \
    --suffix-storage-endpoint "local.azurestack.external" \
    --suffix-keyvault-dns ".vault.local.azurestack.external" \
    --endpoint-active-directory-graph-resource-id "https://graph.windows.net/" \
    --endpoint-vm-image-alias-doc <URI of the document which contains virtual machine image aliases>
  2. Set the active environment by using the following commands.
    az cloud set \
    -n AzureStackUser
  3. Update your environment configuration to use the Azure Stack specific API version profile. To update the configuration, run the following command:
    az cloud update \
    --profile 2017-03-09-profile
  4. Sign in to your Azure Stack environment by using the az login command. You can sign in to the Azure Stack environment either as a user or as a service principal.
    az login \
    -u <Active directory global administrator or user account. For example: username@<aadtenant>.onmicrosoft.com> \
    --tenant <Azure Active Directory Tenant name. For example: myazurestack.onmicrosoft.com>

Install the Microsoft Azure Storage Explorer

Azure Stack Azure Storage Explorer

To access and manage Azure Stack Storage Accounts you can also use the Microsoft Azure Storage Explorer tool. Microsoft Azure Storage Explorer (Preview) is a standalone app from Microsoft that allows you to easily work with Azure Storage data on Windows, macOS and Linux.

If you are running the Azure Stack Development Kit, you should again have a look how you get the certificates implace, you can find that here: Connect Storage Explorer to an Azure Stack subscription

  1. Install the Microsoft Azure Storage Explorer
  2. After Storage Explorer  restarts, select the Edit menu, and then ensure that Target Azure Stack is selected. If it is not selected, select it, and then restart Storage Explorer for the change to take effect. This configuration is required for compatibility with your Azure Stack environment.
  3. To connect to the Azure Stack account, select Add an account.
  4. In the Connect to Azure Storage dialog box, under Azure environment, select Use Azure Stack Environment, and then click Next.
  5. To sign in with the Azure Stack account that’s associated with at least one active Azure Stack subscription, fill in the Sign in to Azure Stack Environment dialog box.
    The details for each field are as follows:Environment name: The field can be customized by user.
    ARM resource endpoint: The samples of Azure Resource Manager resource endpoints:For cloud operator:
    https://adminmanagement.-region-.-FQDN-
    For tenant:
    https://management.-region-.-FQDN-
    Tenant Id: Optional. The value is given only when the directory must be specified.

This should help you quickly setup an Azure Stack Cloud Operator Workstation. What other tools do you need to manage and operator your Azure Stack? leave a comment.

If you want to know more about the responsibilities and toolset of a Azure Stack Operator, check out my blog post at the Microsoft IT OpsTalk blog.



Windows Server 1709

Microsoft released Windows Server 1709

Microsoft just released the new Windows Server version 1709 which is the first release in the Semi-Annual Channel. The Semi-Annual Channel release cadence to deliver innovation at a faster pace, but you will also need to keep updating your systems to newer versions of Windows Server. As of today, you can download Windows Server 1709 from the Volume license portal or deploy it in Microsoft Azure, since it is available in the Azure Marketplace.

Windows Server 1709 Features and Improvements

Windows Server 1709 will drive innovation in the container space and in the Windows Subsystem for Linux, as well as some Cloud Host improvements in Hyper-V with new support for Storage Class Memory and more. Windows Server 1709 will be only available as Windows Server Core (Standard and Datacenter).

If you want to know more about the new features and improvements in Windows Server 1709, check out my blog post and check also out the Microsoft What’s new in Windows Server 1709 page.

https://www.thomasmaurer.ch/2017/05/windows-server-news-from-microsoft-build-2017-it-is-all-about-containers/

New Windows Server Management Experience

If you want to know more about the new Management Experience called Project Honolulu, check out my blog post:

https://www.thomasmaurer.ch/2017/09/microsoft-project-honolulu-the-new-windows-server-management-experience/

Windows Server Servicing

For more information about the Semi-Annual Channel and Windows Server Servicing check out my blog posts:

https://www.thomasmaurer.ch/2017/10/windows-server-release-information-windows-server-semi-annual-channel-and-ltsc/

 

https://www.thomasmaurer.ch/2017/06/what-is-next-for-windows-server-and-system-center-with-a-faster-release-cadence/

Windows Server, version 1709 is only the first step in this new world of faster release cadences. The most important aspect of having new releases twice a year is customer feedback will shape the product. You can try the preview builds of Windows Server in the Semi-Annual Channel and provide feedback by joining the Windows Insiders program. You can also join the conversation in the Microsoft Tech Community where we have tons of professionals and experts sharing their learnings and answering questions.