Skip to content

Instantly share code, notes, and snippets.

@squillace
Last active May 5, 2016 07:15
Show Gist options
  • Save squillace/30a569f7c7fbf52b7ade54cc059090eb to your computer and use it in GitHub Desktop.
Save squillace/30a569f7c7fbf52b7ade54cc059090eb to your computer and use it in GitHub Desktop.
The magic -Q Azure CLI alias

Call: azure vm quick-create -M ~/.ssh/id_rsa.pub -Q RHEL

Output:

info:    Executing command vm quick-create
Resource group name: rhel-quick
Virtual machine name: rhel
Location name: westus
Operating system Type [Windows, Linux]: linux
User name: ops
+ Listing virtual machine sizes available in the location "westus"
+ Looking up the VM "rhel"
info:    Verifying the public key SSH file: /Users/ops/.ssh/id_rsa.pub
info:    Using the VM Size "Standard_DS1"
info:    The [OS, Data] Disk or image configuration requires storage account
+ Looking up the storage account cli163001687
info:    Could not find the storage account "cli16301687", trying to create new one
+ Creating storage account "cli16301687" in "westus"
+ Looking up the storage account cli16301687
+ Looking up the NIC "rhel-westu-16371-nic"
info:    An nic with given name "rhel-westu-16371-nic" not found, creating a new one
+ Looking up the virtual network "rhel-westu-1671-vnet"
info:    Preparing to create new virtual network and subnet
+ Creating a new virtual network "rhel-westu-16371-vnet" [address prefix: "10.0.0.0/16"] with subnet "rhel-westu-168171-snet" [address prefix: "10.0.1.0/24"]
+ Looking up the virtual network "rhel-westu-16371-vnet"
+ Looking up the subnet "rhel-westu-1638171-snet" under the virtual network "rhel-westu-163171-vnet"
info:    Found public ip parameters, trying to setup PublicIP profile
+ Looking up the public ip "rhel-westu-163071-pip"
info:    PublicIP with given name "rhel-westu-1630171-pip" not found, creating a new one
+ Creating public ip "rhel-westu-1631-pip"
+ Looking up the public ip "rhel-westu-16371-pip"
+ Creating NIC "rhel-westu-163171-nic"
+ Looking up the NIC "rhel-westu-163071-nic"
+ Looking up the storage account clisto658rhel
+ Creating VM "rhel"
+ Looking up the VM "rhel"
+ Looking up the NIC "rhel-westu-1671-nic"
+ Looking up the public ip "rhel-westu-1630678171-pip"
data:    Id                              :/subscriptions/<snip />/resourceGroups/rhel-quick/providers/Microsoft.Compute/virtualMachines/rhel
data:    ProvisioningState               :Succeeded
data:    Name                            :rhel
data:    Location                        :westus
data:    Type                            :Microsoft.Compute/virtualMachines
data:
data:    Hardware Profile:
data:      Size                          :Standard_DS1
data:
data:    Storage Profile:
data:      Image reference:
data:        Publisher                   :RedHat
data:        Offer                       :RHEL
data:        Sku                         :7.2
data:        Version                     :latest
data:
data:      OS Disk:
data:        OSType                      :Linux
data:        Name                        :clic5a05492101
data:        Caching                     :ReadWrite
data:        CreateOption                :FromImage
data:        Vhd:
data:          Uri                       :https://cli17.blob.core.windows.net/vhds/clic5abbs-1462425492101.vhd
data:
data:    OS Profile:
data:      Computer Name                 :rhel
data:      User Name                     :ops
data:      Linux Configuration:
data:        Disable Password Auth       :true
data:
data:    Network Profile:
data:      Network Interfaces:
data:        Network Interface #1:
data:          Primary                   :true
data:          MAC Address               :00-0D-3A-32-0F-DD
data:          Provisioning State        :Succeeded
data:          Name                      :rhel-westu-16371-nic
data:          Location                  :westus
data:            Public IP address       :104.42.236.196
data:            FQDN                    :rhel-westu-1671-pip.westus.cloudapp.azure.com
data:
data:    Diagnostics Profile:
data:      BootDiagnostics Enabled       :true
data:      BootDiagnostics StorageUri    :https://cli8rhel.blob.core.windows.net/
data:
data:      Diagnostics Instance View:
info:    vm quick-create command OK

The new help explains the "aliases":

help:      -Q, --image-urn <image-urn>                    the image URN in the form "publisherName:offer:skus:version",
help:                                                     URN Aliases:
help:                                                       Win2012R2Datacenter = MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:latest
help:                                                       Win2012Datacenter = MicrosoftWindowsServer:WindowsServer:2012-Datacenter:latest
help:                                                       Win2008R2SP1 = MicrosoftWindowsServer:WindowsServer:2008-R2-SP1:latest
help:                                                       CentOS = OpenLogic:CentOS:7.2:latest
help:                                                       CoreOS = CoreOS:CoreOS:Stable:latest
help:                                                       Debian = credativ:Debian:8:latest
help:                                                       openSUSE = SUSE:openSUSE:13.2:latest
help:                                                       RHEL = RedHat:RHEL:7.2:latest
help:                                                       SLES = SUSE:SLES:12-SP1:latest
help:                                                       UbuntuLTS = Canonical:UbuntuServer:14.04.4-LTS:latest
help:                                                     or the VHD link of a user image,
help:                                                     e.g. https://foo.blob.core.windows.net/bar/vhds/baz.vhd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment