Public preview of Azure Cloud Shell

At the recent Build conference, Microsoft officially announced public preview of Azure Cloud Shell browser-accessible, pre-configured shell experience for managing Azure resources without the overhead of installing, versioning, and maintaining a machine yourself.

Cloud Shell runs entirely on containers orchestrated by Kubernetes and shows us just another example of how container technology can revolutionize solutions built on Azure.

Machine for Cloud Shell is not persistent and temporary provided on a per-request basis (1 machine per 1 user, permissions are set as a regular Linux user). That machine’s hosting is free. You just need to pay for storage that it consumes (file share –> described later in this post).

Cloud Shell comes with the support of well known tools and languages:

Category Name
Azure Tools Azure CLI 2.0 and 1.0
Linux shell interpreter Bash,sh
Text editors vim,nano,emacs
Containers Docker,Kubectl, DC/OS CLI
Language Version
.NET 1.01
Go 1.7
Node.js 6.9.4
Python 2.7 and 3.5
More: use this link

It supports Bash experience so far. Everyone’s favorite PowerShell is coming soon. You can try the new shell today by pressing the special icon at the top navigation bar of the Azure portal.

azure

The new storage account (LRS), resources group and file share will be created during one-time setup.

  • Resource group is named: cloud-shell-storage-
  • Storage Account: cs-uniqueGuid
  • File Share: cs—com-uniqueGuid

As Cloud Shell’s machine is temporary, file share makes possible to persist your bash $Home directory. This file share will mount as clouddrive under your $Home directory and it’s also used to store a 5 GB image created for you that automatically updates and persists your $Home directory as well (see the pic below, acc_<username>.img).

Note: you pay only for this file share. There are no any  additional compute costs.

SNAGHTML5a54f4

To download/upload files you can use portal as usual. For example, I created txt-file in my clouddrive and would like to download it to my local machine. So, I need to open the file share associated with cloud shell, locate the file “text.txt” and just hit “Download”.

To add some files from local machine to clouddrive, use the “Upload” button and then check result by running cd clouddrive and  ls in the cloud shell session

SNAGHTML7097ce

As you may noticed, Cloud Shell automatically authenticates on each session for instant access to your resources through the Azure CLI 2.0. You can even use the interactive mode for Azure CLI 2.0 to ease scripting and save a lot of time

azure shell

Each cloud shell session times out after 10 minutes without any activities

image

That’s great, but that is not the whole news

Cloud Shell is also embedded directly in docs.microsoft.com and it makes Azure CLI samples in documentation fully interactive. To evaluate this new functionality, go to Azure CLI 2.0 documentation, log in to Cloud Shell by clicking “Try it” and start learning in just a new way.

azure cloud shell and docs

Some more examples

Creating VM in the cloud shell

SNAGHTMLa23890

List of VMs in the resource group with customized output

SNAGHTMLb64914

Automate Exchange 2016 installation and DAG configuration with PowerShell DSC

Hi, folks!

Version 1.0 has already been published here (simple script for automation of Exchange 2016 installation. can be used on multiple servers).

Today’s version is a little bit improved (2 separate files for 2-node configuration, 535 and 420 strings respectively, can be easy scaled out with copy-paste to more than 2 nodes). It helps you to install Exchange, prepare environment for DAG (prestage CNO, witness and etc) and create one with at least 2 members

Each node can be configured simultaneously (it’s not needed to wait while fist node finishes all tasks and etc. just run both scripts, relax and get a cup of coffee). It’s also ideally suitable for using as a part of VMM Service Templates or other kinds of unattended installations (I’ll show you it later)

If you’d like to get script files – write me directly or leave request in the comments. I’ll send you zip-file.

What does script do (exch01.ps1)?

  • Sets network settings (DNS, IP, GW) on targeted server
#..........
xIPAddress NewIPAddress #Set IPv4 on Ethernet adapter
        {
            IPAddress      = $ip
            InterfaceAlias = "Ethernet"
            SubnetMask     = 24
            AddressFamily  = "IPV4"
            DependsOn       = "[xDhcpClient]DisabledDhcpClient"
        }
         xDefaultGatewayAddress GW #Set GW address
        {
            Address = $gw
            InterfaceAlias = "Ethernet"
            AddressFamily = "IPv4"
            DependsOn     = "[xIPAddress]NewIPAddress"
        }
#...........
  • Installs required prerequisites for Exchange (including UCMA) and does reboot if it’s really required
#........
 WindowsFeature WebNet45
        {
            Ensure = 'Present'
            Name = 'Web-Net-Ext45'
        }
     WindowsFeature WebReq
        {
            Ensure = 'Present'
            Name = 'Web-Request-Monitor'
        }
     WindowsFeature WebSrv
        {
            Ensure = 'Present'
            Name = 'Web-Server'
        }
#.........
  • Adds server to domain and reboots it to apply changes
 xComputer DomainJoin
        {
          Name = $nodename
          DomainName = $domainname
          Credential = $creds
          DependsOn  = "[xDnsServerAddress]DNSServers"
        }
  • Setups Exchange and checks if reboot is required after installation
 xExchInstall InstallExchange
        {
            Path       = "C:\ExchInstall\Exch\Setup.exe"
            Arguments  = "/mode:Install /role:Mailbox /OrganizationName:""$netbios"" /Iacceptexchangeserverlicenseterms"
            Credential = $Creds

            DependsOn  = '[xPendingReboot]BeforeExchangeInstall'
        }
  • Adds and checks that DAG CNO is existed and required permissions are applied
#...........
SetScript = {
                    $creds = New-Object Management.Automation.PSCredential("$($using:netbios)\Administrator",(ConvertTo-SecureString $using:pass -AsPlainText -Force))
                    New-ADComputer -Name DAG01 -DNSHostName DAG01 -DisplayName DAG01 -Enabled $false -Credential $creds -verbose
                    $DC=(Get-ADDomainController -Credential $creds).HostName
                    ICM -ComputerName $DC -Credential $creds -ScriptBlock {
                    #Variables
                    $dagacc = Get-ADComputer DAG01 #-Credential $creds
                    $dagldap="LDAP" + '://' + $dagacc.DistinguishedName
                    $dagadsi = New-Object DirectoryServices.DirectoryEntry $dagldap
                    #.....
                    }
#...........
  • Configures witness server, DAG and generates status of successful completion
#........
xExchDatabaseAvailabilityGroup DAG
        {
            Name                                 = $dagSettings.DAGName
            Credential                           = $creds
            AutoDagTotalNumberOfServers          = $dagSettings.AutoDagTotalNumberOfServers
            AutoDagDatabaseCopiesPerVolume       = $dagSettings.AutoDagDatabaseCopiesPerVolume
           #.......
            WitnessDirectory                     = 'C:\FSW'
            WitnessServer                        = $dagSettings.WitnessServer
        }
#.........

Script file named as exch02.ps1 has almost the same steps with the following differences:

  1. Waits while Exchange setup initiated on the first node finishes Active Directory preparation and then starts Exchanges installation on the second node
  2. Waits while DAG becomes online and only then starts adding the second node
  3.  No witness and DAG CNO preparation (hope it’s clear)

Requirements are still the same: exchange media, UCMA package, certificates for securing MOF-files (optional). All prerequisites (except Exchange media files) are in the zip-file (all-in-one).

Thanks for reading and have a nice week!