Skip to content

Instantly share code, notes, and snippets.

@ryanwi
Last active November 15, 2017 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ryanwi/8877209 to your computer and use it in GitHub Desktop.
Save ryanwi/8877209 to your computer and use it in GitHub Desktop.
# Install command line tools
# http://www.windowsazure.com/en-us/documentation/articles/command-line-tools/
# setup xplat-cli (Cross Platform Command Line Interface)
# http://www.windowsazure.com/en-us/documentation/articles/xplat-cli/#install
$ azure account download
$ azure account import {path to .publishsettings file}
info: Executing command account import
info: Found subscription: Windows Azure MSDN - Visual Studio Professional
info: Setting default subscription to: Windows Azure MSDN - Visual Studio Professional
info: Use "azure account set" to change to a different one
info: Setting service endpoint to: https://management.core.windows.net/
warn: The "Windows Azure MSDN - Visual Studio Professional-2-8-2014-credentials.publishsettings" file contains sensitive information
warn: Remember to delete it now that it has been imported
info: Account publish settings imported successfully
info: account import command OK
# Generate keys
# http://www.windowsazure.com/en-us/documentation/articles/linux-use-ssh-key/
# list available images
$ azure vm image list
# create a centos VM
# Without the -P or --no-ssh-password option, SSH will not work, will get:
# Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
$ azure vm create -z small --location "West US" --ssh 22 --ssh-cert <path to cert.pem> -P <vm-name> 5112500ae3b842c8b9c604889f8753c3__OpenLogic-CentOS-65-20140121 <user>
# view status
$ azure vm list
info: Executing command vm list
+ Getting virtual machines
data: Name Status Location DNS Name
data: --------- ---------------- -------- ----------------------
data: <vm-name> RoleStateUnknown West US <vm-name>.cloudapp.net
info: vm list command OK
# Open endpoint if missed in vm create
$ azure vm endpoint create -n SSH <vm-name> 22
# Connect
ssh -i <path to private key> <user>@<vm-name>.cloudapp.net
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment