LoginSignup
0
0

More than 5 years have passed since last update.

Azure CLI をインストールしてみた

Last updated at Posted at 2016-12-24

Azure CLI をインストールし、既に作成しておいたMicrosoft Azure 仮想マシンの
一覧表示までしてみた。

環境

Amazon Linux

nvm のインストール

nvm は Node.js のバージョン管理マネージャで
node.jsのバージョン変更を簡単に切り替えできるツール

インストールにgitを使用

$ git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`

パスを通し、バージョン確認

$ . ~/.nvm/nvm.sh
$ nvm --version
0.32.1

~/.bash_profileにも下記を追記し、ターミナル起動時にnvmコマンドが使えるようにする

if [[ -s /Users/ホームディレクトリ/.nvm/nvm.sh ]] ; then source /Users/ホームディレクトリ/.nvm/nvm.sh ; fi

Node.js のインストール

Node.js をインストールするその前に
インストールバージョン確認

$ nvm ls-remote
         v0.1.14
...
         v7.2.0
         v7.2.1
         v7.3.0

Node.js をインストール

$ nvm install v7.3.0
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v7.3.0 (npm v3.10.10)
Creating default alias: default -> v7.3.0

バージョン確認

$ node -v
v7.3.0

Azure CLIのインストール

Azure CLIをインストール

$ npm install -g azure-cli
npm WARN deprecated node-uuid@1.4.7: use uuid module instead
/root/.nvm/versions/node/v7.3.0/bin/azure -> /root/.nvm/versions/node/v7.3.0/lib/node_modules/azure-cli/bin/azure

> fibers@1.0.15 install /root/.nvm/versions/node/v7.3.0/lib/node_modules/azure-cli/node_modules/fibers
> node build.js || nodejs build.js

インストールされている事を確認

$ azure
info:             _    _____   _ ___ ___
info:            /_\  |_  / | | | _ \ __|
info:      _ ___/ _ \__/ /| |_| |   / _|___ _ _
info:    (___  /_/ \_\/___|\___/|_|_\___| _____)
info:       (_______ _ _)         _ ______ _)_ _
info:              (______________ _ )   (___ _ _)
info:
info:    Microsoft Azure: Microsoft's Cloud Platform
info:
info:    Tool version 0.10.8
...
...
...

Azure サブスクリプションに Azure CLI を接続するための Azure アカウント資格情報を登録

「azure login」を入力

$ azure login
info:    Executing command login
- Authenticating...info:    To sign in, use a web browser to open the page https://aka.ms/devicelogin and enter the code ********* to authenticate.
\

上記にて表示されたURLに自端末のブラウザ等から接続し
*********で表示されたcodeを記入、その後に自身のアカウントを選択

201612242231_000.JPG

次のような内容が表示され設定が完了した事を確認


|info:    Added subscription 無料試用版
info:    Setting subscription "無料試用版" as default
+
info:    login command OK

試しにvm listコマンドで既に作成していた仮想マシンの情報が表示される事を確認

$ azure vm list
info:    Executing command vm list
+ Getting virtual machines
data:    ResourceGroupName  Name   ProvisioningState  PowerState  Location  Size
data:    -----------------  -----  -----------------  ----------  --------  ---------------
data:    TEST               test1  Succeeded          VM running  eastus    Standard_DS1_v2
info:    vm list command OK
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0