_    _____   _ ___ ___
             /_\  |_  / | | | _ \ __|
       _ ___/ _ \__/ /| |_| |   / _|___ _ _
     (___  /_/ \_\/___|\___/|_|_\___| _____)
        (_______ _ _)         _ ______ _)_ _ 
               (______________ _ )   (___ _ _)
     
     Windows Azure: Microsoft's Cloud Platform
    

Mirosław Pragłowski / @mpraglowski
made with VIM ;)

why use cli when we have nice web ui?

  • you can click... and click, and click...
  • you could use SDK and write your environments management code
  • you could use plain JSON API
  • but...
  • cli is the fastest way to handle environments management

and it has ASCII art ;)

              _    _____   _ ___ ___
             /_\  |_  / | | | _ \ __|
       _ ___/ _ \__/ /| |_| |   / _|___ _ _
     (___  /_/ \_\/___|\___/|_|_\___| _____)
        (_______ _ _)         _ ______ _)_ _ 
               (______________ _ )   (___ _ _)
     
     Windows Azure: Microsoft's Cloud Platform
    

azure-cli is open source!

  • like other Azure tools & SDKs azure-cli is open source
  • Apache License Version 2.0
  • hosted at Github: azure-sdk-tools-xplat
  • need help? there is Windows Azure Developer Forums on MSDN & StackOverflow
  • still need help? check IRC channel on freenode: node-azure
  • found a bug? report it on Github Issues ;)

contributing to azure-cli

  • it's really open source - you can contribute :)
  • before: see the guidelines
  • need something? create an issue with feature request
  • want to send some code? need to sign CLA (Contribution License Agreement)
  • there is a step by step guide on guidelines

types of azure-cli

  • for Powershell fans: Windows Azure Powershell
  • for others (not running Windows): Cross Platform CLI
  • but Cross Platform CLI is really cross platform !
  • it even runs on Windows ;)
  • you just need a Node.js & npm installed

installation

you could download & use installers for Windows, OSX & Linux

all you need is Node.js

  • go to node.js and click install
  • next, next, next... done :)
  • BTW have you heard about chocolatey?
  • simple: cinst nodejs.install
  • cinst nodejs - this is only node command line tools, without npm
  • add C:\Program Files\nodejs\ to PATH

installing azure cli

  • for Powershell fans: check MSDN :P
  • for all others:
  • npm install -g azure-cli
  • completion (bash only): npm install -g azure-completion

connecting to subscription

  • need to get subscription settings
  • azure account download
  • need to import profile
  • azure account import {path to .publishsettings file}
  • support for multiple subscriptions
  • azure account set {subscription-name}

azure noun [topic]
verb [options]

nouns

account        Commands to manage your account information and publish settings
config         Commands to manage your local settings
hdinsight      Commands to manage your HDInsight accounts
mobile         Commands to manage your Mobile Services
network        Commands to manage your Networks
sb             Commands to manage your Service Bus configuration
service        Commands to manage your Cloud Services
site           Commands to manage your Web Sites
sql            Commands to manage your SQL Server accounts
storage        Commands to manage your Storage objects
vm             Commands to manage your Virtual Machines
    

learn more

  • azure help - basic nouns list
  • azure help {noun} - help for given noun
  • ... and of course: azure help {noun} {topic} {verb}
  • ... and short form: azure noun verb -h
  • beware of deprecated commands!

setup azure subscription

  • azure account download
  • azure account import .publishsettings
  • azure account list

setup website

  • azure site create --location "West Europe"
    --git --gitusername "mpraglowski" azurecli
  • azure site scale mode --mode standard azurecli
  • azure site scale instances --instances 2 azurecli
  • azure site show azurecli
  • azure site browse azurecli

setup database

  • azure sql server create --administratorLogin mpraglowski --administratorPassword ******** --location "West Europe" --defaultFirewallRule
  • azure sql firewallrule create --serverName iir8l6h9d8 --ruleName local --startIPAddress 78.10.94.10
  • azure sql db create --serverName iir8l6h9d8 --databaseName azurecli --administratorLogin mpraglowski --administratorPassword ********
  • azure sql firewallrule list --serverName iir8l6h9d8
  • azure sql db list --serverName iir8l6h9d8 --administratorLogin mpraglowski --administratorPassword ********

setup storage

  • azure storage account create --location "West Europe" azurecli
  • azure storage account keys list azurecli
  • azure storage container list --account-name azurecli --account-key KEYHERE
  • azure storage container create --account-name azurecli --account-key KEYHERE azurecli
  • azure storage blob list --account-name azurecli --account-key KEYHERE --container azurecli
  • azure storage blob upload --account-name azurecli --account-key KEYHERE --container azurecli index.html

set connection string

  • azure site connectionstring add --connectionname default --value XXX --type "SQLAzure" azurecli
  • azure site connectionstring list azurecli
  • azure site connectionstring show default azurecli

set application settings

  • azure site config list azurecli
  • azure site config add key=value azurecli
  • azure site config get key azurecli

setup domain

  • azure site domain list azurecli
  • create a CNAME record pointing to azurecli.azurewebsites.net
  • azure site domain add --dn azurecli.com azurecli

git push deployment

  • git push azure master

sample app

https://github.com/mpraglowski/azure-cli-sampleapp

workshop

  • install nodejs
  • install azure-cli
  • download publish settings
  • list your azure assets
  • setup simple website
  • setup git publish for website
  • setup github publish
  • setup dabatase
  • setup storage
  • configure appsettings
  • configure connection string

Available at

http://praglowski.com/presentations/azure-cli