PowerShell: Connecting to Azure!

Here comes the Azure PowerShell module!
To automate the provisioning and management of Window Azure, you’ll need the Azure PowerShell module. The Azure team makes this module available as a free download, and this module provides approximately 180 Windows PowerShell cmdlets for automating Azure storage, virtual machines, virtual networks, and other cloud services.

To get started, you’ll need the following prerequisite items:

An Azure subscription – If you don’t currently have a paid subscription, you can sign-up for a FREE trial subscription on the Azure account site.
Azure PowerShell module – Download and install the Azure PowerShell module on a PC running Windows PowerShell 2.0 or Windows PowerShell 3.0.
After you satisfy these prerequisites, you’ll be prepared to follow along with the rest of this post.

Connect PowerShell to your Azure subscription.
After downloading and installing the Azure PowerShell module, you need to perform the following initial steps from Windows PowerShell to configure connection information for your Azure subscription. After you perform these steps the first time, the configuration is saved locally, and you do not need to perform these steps again.

1. Set the Windows PowerShell script execution policy to RemoteSigned:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

2. Import the Azure PowerShell module:

Import-Module Azure

After you complete the steps in this section, Windows PowerShell is configured to connect to your Azure subscription. To test this connection, enter the following cmdlet to connect to Azure and enumerate your subscription information:


#Install AzureRM Module
Install-Module AzureRM

# To log in to Azure Resource Manager
$cred = Get-Credential -Credential Domain\User
Login-AzureRmAccount -Credential $cred

# To view all subscriptions for your account
Get-AzureRmSubscription | Select-AzureRmSubscription

# To select a default subscription for your current session.
Get-AzureRmSubscription -SubscriptionName $subscription | Select-AzureRmSubscription

SSH on Windows 10 with Fall 2017 Update!


It has come to my attention that you can now install SSH on Windows 10 version 1709 “Fall Creators Update” (OS Build 10.0.16299). To find what version of Windows 10 you are currently running, hit Windows Key + R and type winver.


Installing OpenSSH on Windows 10 is done inside the Optional Feature section. You simply have to type in Manage Optional Features into the Windows 10 Search. Open the result. That is a lot of manual work, but it can be done with PowerShell or CMD line, located at the bottom of this post.

2017-11-28 14_03_09-.png

Once the window is open click on Add a Feature. Here you will see OpenSSH Client (Beta) and OpenSSh Server (Beta). Select the OpenSSH Client (Beta). It will install in a matter of seconds.

You will need to do a reboot, but soon as you are back into your system you can simply open up PowerShell or the Command Prompt and type ssh. This is because openSSH client binaries have been appended to the System Environment Variables PATH.

OpenSSH is still in beta and therefore has limitations, but this is still a great feature to have on Windows 10. Working with a lot of Linux distributions in the Public Cloud offerings use to be a hassle. No more PuTTY, PSEXEC or WinRM!

You can simply do it with PowerShell as well:

get-windowsoptionalfeature -online //This list all optional features
get-WindowsOptionalFeature -Online -FeatureName "*OpenSSH*" //This only find the feature with OpenSSH
Enable-WindowsOptionalFeature -Online -FeatureName "*OpenSSH*Client*" -All //This install OpenSSH Client

//Disable the Optional Feature by
Disable-WindowsOptionalFeature -Online -FeatureName "*OpenSSH*"

Or with command-line

<span data-mce-type="bookmark" style="display: inline-block; width: 0px; overflow: hidden; line-height: 0;" class="mce_SELRES_start"></span>
dism /online /get-capabilities | findstr /i "OpenSSH.Client"