TExcelTAD
Home › Azure & Google Cloud for AWS Users › Consoles, az, gcloud and Cloud Shell

Consoles, az, gcloud and Cloud Shell

Each cloud has a web console, a CLI, SDKs and a browser shell with the CLI preinstalled. The concepts match the AWS CLI closely; the habits differ in how you sign in, how you pick where a command acts, and how you filter output.

On AWS this is… the AWS Management Console, aws configure / aws sso login, profiles, --region, --query (JMESPath) and --output, from AWS CLI and SDK and AWS Account and Console.

The tools

AWS Azure Google Cloud
Web console AWS Management Console Azure portal (portal.azure.com) Google Cloud console (console.cloud.google.com)
CLI aws az (Azure CLI); also Azure PowerShell (Az module) gcloud (Google Cloud CLI), plus bq, gcloud storage
Browser shell AWS CloudShell Azure Cloud Shell (Bash or PowerShell) Cloud Shell (Bash, with an editor)
Sign in (human) aws sso login az login gcloud auth login
Credentials for SDKs/Terraform on your laptop the same profile az login (SDKs use AzureCliCredential via DefaultAzureCredential) gcloud auth application-default login (Application Default Credentials)
"Where am I?" aws sts get-caller-identity az account show gcloud config list, gcloud auth list
Pick the target --profile, --region az account set --subscription, --resource-group, --location gcloud config set project, --project, --region/--zone
Named profiles ~/.aws/config profiles none built in; switch subscriptions, or use separate AZURE_CONFIG_DIRs gcloud config configurations create <name>
Output --output json|table|text|yaml --output json|jsonc|table|tsv|yaml|none --format=json|yaml|table(...)|value(...)|csv(...)
Filter --query (JMESPath, client side), --filter on some APIs --query (JMESPath, client side) --filter (server-side where possible) and --format projections

The Google Cloud one deserves a note: gcloud auth login authorises the CLI; gcloud auth application-default login creates separate Application Default Credentials that client libraries and Terraform use. Forgetting the second is the classic "gcloud works but Terraform says no credentials" problem.

A first session on each

Sample session, Azure (IDs made up):

bash
az login                                   # opens a browser, or use --use-device-code
az account list --query "[].{name:name, id:id, default:isDefault}" -o table
az account set --subscription "shop-dev"
az configure --defaults group=rg-shop-dev location=westeurope
az group list -o table
text
Name        Id                                    Default
----------  ------------------------------------  ---------
shop-dev    6c1f0a52-0d7e-4a8e-9a51-3c2b7e1d9f10  True
shop-prod   8e2b4d17-5a93-4c06-b1f2-7d4e9a0c3b25  False
Name           Location     Status
-------------  -----------  ---------
rg-shop-dev    westeurope   Succeeded

Sample session, Google Cloud:

bash
gcloud auth login
gcloud config configurations create shop-dev
gcloud config set project shop-dev-4821
gcloud config set compute/region europe-west1
gcloud config list
gcloud auth application-default login       # for Terraform and SDKs
text
[compute]
region = europe-west1
[core]
account = ada@example.com
disable_usage_reporting = True
project = shop-dev-4821

Your active configuration is: [shop-dev]

Querying output

Both clouds return JSON; the filters look different.

bash
# Azure: JMESPath, client side (same language as aws --query)
az vm list -g rg-shop-dev --query "[?location=='westeurope'].{name:name, size:hardwareProfile.vmSize}" -o table

# Google Cloud: --filter narrows the list, --format shapes the output
gcloud compute instances list --filter="status=RUNNING AND zone~europe-west1" \
    --format="table(name, machineType.basename(), zone.basename(), status)"
gcloud compute instances list --format="value(name)"      # one bare value per line, good in scripts

Since az --query is JMESPath, everything from aws --query transfers directly. gcloud --format has its own small projection language: basename() strips a URL down to its last segment, which you need because many fields are full resource URLs.

Here is what basename() does to a typical field, and the same JMESPath-style filter written in plain Python:

python · try it yourself
instances = [
    {"name": "web-1", "status": "RUNNING",
     "zone": "https://www.googleapis.com/compute/v1/projects/shop-dev-4821/zones/europe-west1-b",
     "machineType": "https://www.googleapis.com/compute/v1/projects/shop-dev-4821/zones/europe-west1-b/machineTypes/e2-medium"},
    {"name": "web-2", "status": "TERMINATED",
     "zone": "https://www.googleapis.com/compute/v1/projects/shop-dev-4821/zones/europe-west1-c",
     "machineType": "https://www.googleapis.com/compute/v1/projects/shop-dev-4821/zones/europe-west1-c/machineTypes/e2-medium"},
]
basename = lambda url: url.rsplit("/", 1)[-1]

print(f"{'NAME':<7}{'MACHINE_TYPE':<14}{'ZONE':<16}STATUS")
for i in instances:
    if i["status"] == "RUNNING":
        print(f"{i['name']:<7}{basename(i['machineType']):<14}{basename(i['zone']):<16}{i['status']}")
NAME   MACHINE_TYPE  ZONE            STATUS
web-1  e2-medium     europe-west1-b  RUNNING

Scripting habits that transfer

  • Always pass the target explicitly in scripts (--subscription, --project), never rely on whatever the last interactive set left behind.
  • Use -o tsv (Azure) or --format="value(...)" (Google Cloud) to capture single values: ID=$(az vm show -g rg -n vm1 --query id -o tsv).
  • Azure long-running operations accept --no-wait; many gcloud commands accept --async. Poll or wait explicitly afterwards (az vm wait --created, gcloud … operations describe).
  • Both CLIs prompt for confirmation on deletes: az group delete --yes, gcloud … delete --quiet in automation.

Test yourself

Terraform on your laptop says it can't find Google credentials, but gcloud commands work. What did you probably skip?

  1. gcloud init
  2. gcloud auth application-default login
  3. az login
  4. Enabling billing

Which query language does az --query use?

  1. KQL
  2. JMESPath, like aws --query
  3. SQL
  4. CEL

What does --format="value(name)" do in gcloud?

  1. Prints JSON
  2. Prints just the name field, one per line, without headers
  3. Filters by name
  4. Renames resources