Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Working with azure cli

Working with Azure CLI

1. Install Node.js

Go to http://nodejs.org/ and choose your installer

2. Install azure cli

Project page Documentation

$ npm install -g azure-cli

3. From your terminal/console

Get azure account

$ azure account download

$ azure account import ACCOUNT_FILE

$ azure account list

Create azure storage

$ azure storage account create storagename --label STORAGE_LABEL --location "Southeast Asia"

$ azure storage account list

// Get storage key, we will use later
$ storage account keys list STORAGE_NAME

NOTE

  • stooragename must be 2-24 lowercase, no underscore or other non alphanumeric characters
  • storagename must be unique accross azure

Create VM

// Create ssh key
$ openssl req -x509 -nodes -days 36500 -newkey rsa:2048 -keyout MyAzure.key -out MyAzure.pem

// Command: azure vm create [options] <dns-name> <image> <userName> [password]
$ azure vm create \
--blob-url "http://azurecampstorage.blob.core.windows.net/vhds/azurecamp.vhd" \
--vm-size Small \
--vm-name AzureCamp \
--ssh 22 \
--ssh-cert MyAzure.pem \
--no-ssh-password \
--location "Southeast Asia" \
azurecamp \
b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_1-LTS-amd64-server-20140924-en-us-30GB \
azurecamp

$ azure vm list

$ azure vm show AzureCamp

// Create endpoint
$ azure vm endpoint create AzureCamp 3000 3000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.