Tag: Azure PowerShell

Mastering Azure with Cloud Shell

Mastering Azure with Cloud Shell

There are multiple ways to interact and manage resources in Microsoft Azure. You can use the Azure Portal or command line tools like the Azure PowerShell module or the Azure CLI, which you can install on your local machine. However, to set up a cloud management workstation for administrators and developers can be quite a lot of work. Especially if you have multiple machines, keeping consistency between these machines can be challenging. Another challenge is keeping the environment secure and all the tools up to date. This any many more things are addressed by the Cloud Shell.

Cloud Shell is not brand new, Microsoft announced Cloud Shell at Build 2017. This blog post is about how you can master Azure with Cloud Shell and to give you an overview about the possibilities of Cloud Shell.

What is Cloud Shell

Cloud Shell Azure Portal

Cloud Shell offers a browser-accessible, pre-configured shell experience for managing Azure resources without the overhead of installing, versioning, and maintaining a machine yourself. Azure Cloud Shell is assigned per unique user account and automatically authenticated with each session. This makes it a private and secure environment.

You get a modern web-based command line experience which can be accessed from several end points like the Azure Portal, shell.azure.com and the Azure mobile app, Visual Studio Code or directly in the Azure docs.

In the backend Azure uses containers and automatically attaches an Azure File Share to the container. You can store the data on it, so your data is persistent. This persist your data across different Cloud Shell sessions.

Cloud Shell Bash and PowerShell

You can choose your preferred shell experience. Cloud Shell supports Bash and PowerShell and included your favorite third party tools and common tools and languages. If something like a module is missing, you can simply add it.



Azure Cloud Shell

Azure Cloud Shell – shell.azure.com and in Visual Studio Code

Back in May Microsoft made the Azure Cloud Shell available in the Microsoft Azure Portal. Now you can use it even quicker by just go to shell.azure.com. First you login with your Microsoft account or Work and School account, and if your account is in multiple Azure Active Directory tenants, you select the right tenant and you will be automatically logged in. So even if you are on a PC where you can not install the Azure CLI or the Azure PowerShell module, you can still easily fire up a shell where you can run the Azure CLI, Azure PowerShell and other CLI tools like Docker, Kubectl, emacs, vim, nano, git and more.

In addition you can also open up Azure Cloud Shell directly from Visual Studio Code

Azure Cloud Shell Visual Studio Code

With that, enjoy your holidays and I wish you a good start in the new year!



Azure PowerShell Module

Microsoft Azure PowerShell 4.0

Microsoft not only announced the Azure Cloud Shell, Microsoft also announced the Azure PowerShell 4.0. The new Azure PowerShell 4.0.0 adds various improvements and fixes across multiple Azure resources. Focusing on features like Container Service, Service Fabric, Container Registry, SQL, Storage, Replay and a lot more.

You can install the cmdlets via your favorite Azure PowerShell installation path indicated in the Azure PowerShell 4.0.0 release notes.

Also check out my new blog: Mastering Azure using Cloud Shell



Azure Cloud Shell

Microsoft Azure Cloud Shell

Today at the Microsoft Build Conference, Microsoft announced the Azure Cloud Shell. The Azure Cloud Shell is a browser-based shell experience to manage and develop Azure resources.

Azure Cloud Shell offers a browser-accessible, pre-configured shell experience for managing Azure resources without the overhead of installing, versioning, and maintaining a machine yourself. Today it gives you a variety of different tools directly from your web browser in the Azure Portal.

This gives Azure Administrators an easy admin environment to manage resources as well as third-party applications. In the background Microsoft runs thousands of isolated containers, ready for you to use. Microsoft takes care of keeping this container up to date, so you can focus on your administrator tasks. The usage is free, the only thing you will need to pay, are the storage cost for your container and the things you store on the Azure File Share.

Linux shell interpreter

  • Bash
  • sh

Azure tools

  • Azure CLI 2.0 and 1.0

Text editors

  • vim
  • nano
  • emacs

Source control

  • git

Build tools

  • make
  • maven
  • npm
  • pip

Containers

  • Docker
  • Kubectl
  • DC/OS CLI

Databases

  • MySQL client
  • PostgreSql client
  • sqlcmd Utility

Other

  • iPython Client

It also looks like PowerShell will be available later, hopefully it will arrive soon. Microsoft also announced Azure PowerShell 3.0. If you want to learn, check out my blog post: Mastering Azure with Cloud Shell



Install Azure PowerShell Az Module

How to Install the Azure PowerShell Module

This blogs post describes how you can install the Azure PowerShell module. Microsoft a couple of weeks ago released version one of their new Azure PowerShell module on .NET Core called the Az module. The Az module will replace the AzureRM module over time. however, the AzureRM module is still supported. The new Az module is a cross-platform module.

Well if you are working with Microsoft Azure you may need the PowerShell Modules for automation and some settings which are only available in PowerShell. With the latest releases you can install the Azure PowerShell Module using the package management in PowerShell, and install the Azure PowerShell module form the PowerShell Gallery.

Az module features

  • Az is a replacement for AzureRM and AzureRM.Netcore.
  • Runs on PowerShell 5.1 and PowerShell Core.
  • It is always up to date with the latest tooling for Azure services.
  • Az ships in Cloud Shell.
  • It shortens and normalizes cmdlet names. All cmdlets use “Az” as their noun prefix.
  • Az will simplify and normalize module names. Data plane and management plane cmdlets for each service will use the same Az module.
  • It ships with new cmdlets to enable script compatibility with AzureRM (Enable/Disable-AzureRmAlias).

Supported platforms

  • PowerShell 5.1 – Windows 7 or greater with .Net Framework 4.7.2 or greater installed
  • PowerShell Core 6.0 – Windows, Mac OS, Linux
  • PowerShell Core 6.1 – Windows, Mac OS, Linux

Install Azure PowerShell module

For me using the PowerShell Package Management and the PowerShell Gallery is may the easiest and fastest way to install it. In Windows 10 or a computer with the Windows Management Framework 5 installed, you can use the following PowerShell cmdlets to install it.

You should not install Az side-by-side with AzureRM. Remove all AzureRM modules before installing Az.

You can also update the AZ module using the following command:

And you can use the following command to login:

You can also see the Azure PowerShell Modules and versions using the PowerShell Package Management:

AzureRM compatibility

If you would like to run scripts developed for AzureRM using Az, use the Enable/Disable-AzureRmAlias cmdlets to add or remove aliases from AzureRM cmdlets to Az cmdlets.

This can be enabled and disabled:

Run Azure PowerShell from Cloud Shell

You can also run the latest Azure PowerShell module version directly from Cloud Shell, with no need to install it.

This blog post was updated with the release 1.0.0 of the Azure Az module based on .NET Core. You can find more about the new Azure PowerShell module on the GitHub repo.

Also check out my blog post: Mastering Azure using Cloud Shell