Skip to content

Instantly share code, notes, and snippets.

@cyrille-leclerc
Last active March 18, 2016 19:00
Show Gist options
  • Save cyrille-leclerc/2c49db94de5c21131ac2 to your computer and use it in GitHub Desktop.
Save cyrille-leclerc/2c49db94de5c21131ac2 to your computer and use it in GitHub Desktop.
Cyrille's Azure CLI Tips

Switch to ASM mode (classic)

$ azure config mode asm
info:    Executing command config mode
info:    New mode is asm
info:    config mode command OK

List images

ASM mode seem to support less command params

$ azure vm image list | grep -i CloudBees
data:    cloudbees-jenkins-agent_2016-02-03_16-45                                                                              User      Linux    undefined
data:    CloudBees-Jenkins-Enterprise-1.609_2016-03-11_02-27                                                                   User      Linux    undefined
data:    CloudBees-Jenkins-Enterprise-1.642_2016-02-29_12-57                                                                   User      Linux    undefined
data:    CloudBees-Jenkins-Enterprise-1.642_2016-03-17_17-55                                                                   User      Linux    undefined
data:    CloudBees-Jenkins-Enterprise-1.642_2016-03-17_18-21                                                                   User      Linux    undefined
data:    CloudBees-Jenkins-Enterprise-1.642_2016-03-17_19-00                                                                   User      Linux    undefined
data:    CloudBees-Jenkins-Enterprise-1.642_2016-03-17_19-02                                                                   User      Linux    undefined
data:    CloudBees-Jenkins-Operations-Center-1.625_2016-02-04_21-31                                                            User      Linux    undefined
data:    CloudBees-Jenkins-Operations-Center-1.625_2016-02-29_13-33                                                            User      Linux    undefined
data:    CloudBees-Jenkins-Operations-Center-1.625_2016-03-17_18-19                                                            User      Linux    undefined
data:    CloudBees-Jenkins-Operations-Center-1.625_2016-03-18_14-08                                                            User      Linux    undefined

create VM

  • prefer --ssh-cert to --password
  • --json to output as json
  • --vm-name should be a random name
localhost ~ $ azure vm create --json --userName cloudbees --password *****  --vm-size Standard_D2 --vm-name je-clc clc123 CloudBees-Jenkins-Enterprise-1.642_2016-03-17_19-02
info:    Executing command vm create
+ Looking up image CloudBees-Jenkins-Enterprise-1.642_2016-03-17_19-02
+ Looking up cloud service
info:    cloud service clc123 not found.
info:    using the VM image location South Central US
+ Creating cloud service
+ Creating VM
azure vm show --json je-clc
{
  "DNSName": "clc123.cloudapp.net",
  "Location": "South Central US",
  "VMName": "je-clc",
  "IPAddress": "100.75.104.24",
  "InstanceStatus": "ReadyRole",
  "InstanceSize": "Standard_D2",
  "Image": "CloudBees-Jenkins-Enterprise-1.642_2016-03-17_19-02-os-2016-03-17-7543F1D3",
  "OSDisk": {
    "hostCaching": "ReadWrite",
    "name": "clc123-je-clc-0-201603181838490461",
    "mediaLink": "https://cloudbeesvhds.blob.core.windows.net/vhds/eusuzfst.ggz201603181838480416.vhd",
    "sourceImageName": "CloudBees-Jenkins-Enterprise-1.642_2016-03-17_19-02-os-2016-03-17-7543F1D3",
    "operatingSystem": "Linux",
    "iOType": "Standard"
  },
  "DataDisks": [],
  "ReservedIPName": "",
  "VirtualIPAddresses": [
    {
      "address": "40.84.148.238",
      "isDnsProgrammed": true,
      "name": "__PseudoBackEndContractVip"
    }
  ],
  "PublicIPs": [],
  "Network": {
    "Endpoints": [],
    "PublicIPs": [],
    "NetworkInterfaces": []
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment