Search notes:

Cloud Shell (Azure)

Azure Cloud Shell provides a Bash or a PowerShell shell in a web browser.
The URL of the Azure portal is shell.azure.com
Cloud Shell requires
A user can change the default shell to be used for the next session anytime via the environment selector in the Cloud Shell toolbar
All functionality that is provided through the Azure Cloud Shell is also available on the Portal within 180 days after the initial release (on the Shell?)

First use

When Cloud Shell is used the first time, it asks to assign storage:
Clicking advanced options allows to enter the name for a resource group , storage account and file share. (Note that there are some restrictions for the names: For example, the resource name can only consist of letters, digits, underscores, hyphens, parantheses or the storage account only of numbers and lowercase letters).

Copy Paste

Text can be copied from the shell running in the web brower with ctrl+v and inserted into the shell with shift+insert.

Windows Terminal: Azure Cloud Connector

Windows Terminal has an Azure Cloud Connector which allows to connect to the Cloud Shell.

Linux distribution: CBL-Mariner

The Cloud Shell runs on a machine with CBL-Mariner:
$ lsb_release -a
LSB Version:    n/a
Distributor ID: Mariner
Description:    CBL-Mariner 2.0.20231106
Release:        2.0.20231106
Codename:       Mariner

Initial home directory content

After logging in on Azure's Cloud Shell (and thus having created the required storage), the content of the home directory is:
PS /home/rene> get-childItem -attributes !directory -recurse -force | select-object fullName

FullName
--------
/home/rene/.bash_logout
/home/rene/.bashrc
/home/rene/.profile
/home/rene/.tmux.conf
/home/rene/.zcompdump_capture
/home/rene/.local/share/powershell/PSReadLine/ConsoleHost_history.txt
/home/rene/.azure/az.json
/home/rene/.azure/az.sess
/home/rene/.azure/azureProfile.json
/home/rene/.azure/clouds.config
/home/rene/.azure/commandIndex.json
/home/rene/.azure/config
/home/rene/.azure/telemetry.json
/home/rene/.azure/telemetry.txt
/home/rene/.azure/versionCheck.json
/home/rene/.azure/commands/2020-11-17.22-43-29.login.113.log
/home/rene/.azure/commands/2020-11-17.22-43-30.account_set.123.log
/home/rene/.azure/logs/telemetry.log
/home/rene/.azure/telemetry/cache
/home/rene/.cache/powershell/ModuleAnalysisCache-AE0255EC
/home/rene/.cache/powershell/telemetry.uuid
/home/rene/.Azure/AzurePSDataCollectionProfile.json
/home/rene/.Azure/AzureRmContext.json
/home/rene/.Azure/AzureRmContextSettings.json

$PATH

The directories found in the PATH environment variable is
PS /home/rene>  $env:PATH -split ':'
/opt/microsoft/powershell/7
~/.local/bin
~/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/local/linkerd/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/local/istio-latest/bin
/usr/local/go/bin
/opt/mssql-tools/bin
~/bundle/bin
~/bundle/gems/bin
/home/rene/.local/share/powershell/Scripts

get-psProvider

get-psProvider reveals that there is a special Azure: drive:
PS Azure:\> get-psProvider

Name                 Capabilities                                                  Drives
----                 ------------                                                  ------
Alias                ShouldProcess                                                 {Alias}
Environment          ShouldProcess                                                 {Env}
FileSystem           Filter, ShouldProcess, Credentials                            {/, Temp}
Function             ShouldProcess                                                 {Function}
Variable             ShouldProcess                                                 {Variable}
SHiPS                Filter, ShouldProcess                                         {Azure}

Azure: drive

The directories in the Azure: drive correspond to the available subscriptions.
PS /> cd Azure:
PS Azure:\> dir

Mode SubscriptionName   SubscriptionId                       TenantId                             State
---- ----------------   --------------                       --------                             -----
+    TQ84 Subscription  01234567-89ab-cdef-fedc-ba9876543210 fedcba98-7654-3210-0123-456789abcdef Enabled
…

PS Azure:\> cd '/.TQ84 Subscription`
Being «in» a subscription directory, the «sub folders» list different views on the resources.
PS Azure:\> dir
   …
Mode Name
---- ----
+    AllResources
+    ResourceGroups
+    StorageAccounts
+    VirtualMachines
+    WebApps

az init

The init extension is intended to quickly set up global configurations for an enverionment.
$ az extension add --upgrade --name init
The installed extension 'init' is in preview.

$ az init
…

Misc

az commands

Some az commands include:
az account list List subscriptions I have access to
az account set --subscription 'some-subscription-name' Set preferred subscription (and then stored in ~/.azure/azureProfile.json)
az group create --location westus --name SomeRG Create a new resource group
az vm create -n myVM -g SomeRG --image UbuntuLTS --generate-ssh-keys Create an Ubuntu VM in your new resource group. The Azure CLI will create SSH keys and set up the VM with them. (Keys are stored in ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub)

get-az* commands

get-azResourceProvider -listAvailable | select-object providerNamespace, registrationState View all resource providers and their registration status for the current(?) subscription

ACC* environment variables

ACC_CLOUD For example PROD
ACC_LOCATION contains the current region, for example: WESTEUROPE
ACC_OID
ACC_PUID
ACC_STORAGE_PROFILE
ACC_TERM_ID
ACC_TID
ACC_VERSION

PowerShell profile

The PowerShell profile seems to be stored in $HOME/.config/PowerShell.

TODO

$ az provider list -o table
$ az vm list -g $RESOURCE_GROUP_NAME --query "[].id" -o tsv
$ az config get
$ ls ~/.azure
$ az login
$ az feedback
$ az configure --list-defaults
…

$ az configure
Welcome to the Azure CLI! This command will guide you through logging in and setting some default values.

Your settings can be found at /home/rene/.azure/config
Your current configuration is as follows:
…
$ az init

See also

Azure CLI
Azure Portal
/usr/bin/azureLogin.sh

Index