Getting familiar with Azure Management Tools
- Azure PowerShell management has utilized AzureRM modules and their commandlets.
- Especially on Linux platform as well as for developers Azure CLI has been the tool of choice.
- Azure Cloud Shell was announced in Build 2017.
Install AzureRM modules.
Start PowerShell or PowerShell ISE as administrator. \ Install module AzureRM with the following command (accept NuGet Provider installation and consequently module installation from PSGallery repository)
Install-Module AzureRm
- Check which modules are importable with the following command:
Get-Module -ListAvailable
- In which folder are AzureRM modules located?
- Open connection to your Azure subscription with the following command:
Add-AzureRmAccount
- Check which modules are now loaded into memory with the following command:
Get-Module
- Check comdlets available in AzureRM.profile module with the following command:
Get-Command -Module AzureRM.profile
- Check current Azure context with the following command:
Get-AzureRmContext
Get-AzureRmContext | fl
Install Azure CLI
Open azure.microsoft.com or directly shortcut aka.ms/cli.
If you clicked the first link, select More in toolbar and continue by selecting Resources. Scroll down and click Downloads. Click Command-line tools and click Install under Azure command-line interface. Click Install on Windows
If you clicked the second (shortcut) link, click Install for Windows.
- Follow instruction and install Azure CLI.
- Start Command Prompt (or PowerShell) as administrator.
- Start Azure CLI with the following command:
az
- What is Azure CLI version?
- What are the settings that you could configure with the following command (select Y in the first prompt):
az configure
- Open connection to your Azure subscription with the following command:
az login
- Test interactive option with the following command:
az interactive
While in interactive window try running e.g. resource list etc. You can exit interactive shell with + D.
Start using Azure Cloud Shell
- Open shell.azure.com
- Click Bash and then click Show advanced settings. Create new Storage Account with the following settings:
- Subscription: your Azure subscription
- Cloud Shell region: choose (nearest) Region
- Resource group: create new, e.g. rg-cloudshell-
- Storage account: create new, e.g. stcloudshell
File share: e.g. fs-cloudshell01
After cloud shell initializes, try following commands:
> ls -la
> dir
> pwsh
> cd Azure:/<Your Azure subscription> # use <Tab key> to fill subscription
> dir ./AllResources
> lsb_release -a
> uname -a
Try Resource Explorer
Open portal.azure.com
Click All services and find/select Resource Explorer
Examine your subscription's resources in Providers and Subscriptions sections. Check e.g. Provider Microsoft.Storage\storageAccounts and resources under your Azure Pass subscription
PowerShell 7 and Az modules
Install PowerShell 7
Download current (e.g. …-win-x64.msi) PowerShell 7 installation package from github.com/PowerShell/PowerShell
Install PowerShell 7 using defaults. Notice installation folder
Start PowerShell 7 (x64) (as administrator)
Try starting ise with the following command:
ise
Check value of PSEdition parameter in variable $PSVersionTable with the following command:
$PSVersionTable
- Check which modules are importable with the following command:
Get-Module -ListAvailable
- In which folder are those modules located?
your answer
- Check which modules are now loaded into memory with the following command:
Get-Module
- Check module search path with the following command:
$env:PSModulePath
- What is PowerShell Core "home folder" $PSHome?
your answer
Install new Az module with its commands in PowerShell 7
- Install module AzureRM with the following command (accept module installation from PSGallery repository)
Install-Module Az
- Check which modules are importable with the following command:
Get-Module -ListAvailable
- Does command Add-AzureRmAccount work?
your answer
Open azure.microsoft.com/en-us/blog/azure-powers.. and pick and perform the command which enables AzureRM commands
Try again Add-AzureRmAccount. sign in experience differs from the one you already did?
your answer
Visual Studio Code
Install Visual Studio Code
Download current (e.g. Visual Studio Code installer for Windows) installation package from code.visualstudio.com/download
Install package using defaults. However, on Select Additional Tasks, you may want to select Add "Open with Code" action to Windows Explorer file context menu and Add "Open with Code" action to Windows Explorer directory context menu
Notice optional information on installing User package as an administrator
After you've successfully installed it, launch Visual Studio Code (or start it from e.g. PowerShell console with the following command: code or code-insiders depending on the version which you've installed)
Check the contents of Getting Started which opens in your web browser
Install some extensions
Switch to Visual Studio Code and open Extensions by pressing + + X (or from View menu select Extensions or click extensions icon
In search field, type powershell and press
In EXTENSIONS:MARKETPLACE section, click PowerShell Preview yyyy.mm.x) Install button. Select PowerShell ISE as color theme unless you prefer default Dark+ theme
Open any earlier .ps1 file to be modified (or create a new file and save it with .ps1 file extension)
Try that Intellisense auto-completion works by typing e.g. Get-Az. In EXTENSIONS search field, type Azure Account, click extension and after reading description, install this extension
Switch to web browser and install Node.js 6 or later (from nodejs.org) using defaults
Switch back to Visual Studio Code
From View menu, select Command Palette… or press + + P
Type/select Azure: Sign In. Sign in using your Microsoft account. Close browser tab and switch back to Visual Studio Code
From View menu, select Command Palette… or press + + P
Type/select Azure: Open PowerShell in Cloud Shell. If you get an error about Node.js requirement, restart Visual Studio Code and try again (both Sign In and Open PowerShell in Cloud Shell)
In console window Pull down menu, try switching between different options
In PowerShell in Cloud Shell try the following commands:
> dir
> cd azure:/<Your subscription name>
> dir
> cd ./AllResources
> dir
> $PSVersionTable
> Get-Module -Listavailable
Install Azure CLI Tools extension and its automatic code and parameter name completion using IntelliSense by creating .azcli file in a similar manner as you did earlier with PowerShell extension
Install also Azure Resource Manager (ARM) Tools and ARM Template Viewer extensions
Windows Terminal
Install Windows Terminal and open Cloud Shell
Install Windows Terminal (or Preview) from Microsoft Store (you don't have to sign in although it is suggested) or download its installation package from github.com/microsoft/terminal > Releases > Assets and install it using defaults (Microsoft.WindowsTerminalPreview_1.5.3242.0_8wekyb3d8bbwe.msixbundle)
On Terminal toolbar, click down icon and select Azure Cloud Shell (or press + + 4)
Sign in to your Azure subscription
Windows Subsystem for Linux 2 (WSL 2)
Install WSL2 and Linux distribution of your choice
- Open Control Panel > Programs > Turn Windows features on or off
- Enable Virtual Machine Platform and Windows Subsystem for Linux and restart your computer
- Download and install Linux kernel update packet
- Start Windows PowerShell and set WSL 2 as default with command
wsl --set-default-version 2
Open Microsoft Store
Search for Ubuntu version of your choice, e.g. 20.04 LTS. You don't have to sign in unless you want
- Start Ubuntu from Start menu and configure username and password
- Check for available updates with the following command: sudo apt
sudo apt update
- List packages which can be upgraded with the following command:
sudo apt list --upgradable
- Perform updates with command
sudo apt upgrade
- Check Azure CLI version with the following command:
> sudo apt install azure-cli
> az -v