尝试使用 Azure CLI (适用于 Windows)
前提条件
-
- bashが使えるWindows環境(必要ないかも)
-
- node.js, npmインストール済み
-
- ※参考 http://yohshiy.blog.fc2.com/blog-entry-307.html
Microsoftアカウントとサブスクリプションの追加
azureのデプロイモードはリソースマネージャー(ARM)
インストール
# npm install -g azure-cli
確認
# azure --help
info: /_\ |_ / | | | _ \ __|
info: _ ___/ _ \__/ /| |_| | / _|___ _ _
info: (___ /_/ \_\/___|\___/|_|_\___| _____)
info: (_______ _ _) _ ______ _)_ _
info: (______________ _ ) (___ _ _)
info:
info: Microsoft Azure: Microsoft's Cloud Platform
info:
info: Tool version 0.10.8
help:
help: Display help for a given command
help: help [options] [command]
help:
help: Log in to an Azure subscription using Active Directory or a Microsoft account identity.
help: login [options]
help:
help: Log out from Azure subscription using Active Directory. Currently, the user can log out only via Microsoft organizational account
help: logout [options] [username]
help:
help: Open the portal in a browser
help: portal [options]
help:
help: Manages the data collection preference.
help: telemetry [options]
help:
help: Commands:
help: account Commands to manage your account information and publish settings
help: account env Commands to manage your account environment
help: acs Commands to manage your container service.
help: acs config Commands to manage configuration of container-service in the parameter file.
help: acs config agent-pool-profiles Commands to configure agent-pool-profiles of acs in config file.
help: acs config container-service Commands to configure container-service of acs in config file.
help: acs config diagnostics-profile Commands to configure diagnostics-profile of acs in config file.
help: acs config linux-profile Commands to configure linux-profile of acs in config file.
help: acs config master-profile Commands to configure master-profile of acs in config file.
help: acs config orchestrator-profile Commands to configure orchestrator-profile of acs in config file.
help: acs config public-keys Commands to configure public-keys of acs in config file.
help: acs config ssh Commands to configure ssh of acs in config file.
~ 中略 ~
help:
help: Options:
help: -h, --help output usage information
help: -v, --version output the application version
help:
help: Current Mode: arm (Azure Resource Management)
Azureへログイン
# azure login
info: Executing command login
info: To sign in, use a web browser to open the page http://aka.ms/devicelogin. Enter the code XXXXXXXXX to authenticate.
コマンド実行後、ブラウザでhttp://aka.ms/devicelogin へアクセス、ログイン、コマンド実行結果に表示されているコード(XXXXXXXXX箇所)を入力する。
※コード入力すると自動的に以下の出力が表示されプロンプトが戻る。
info: Added subscription Visual Studio Ultimate with MSDN
info: Added subscription Azure Free Trial
info: Setting subscription "Visual Studio Ultimate with MSDN" as default
+
info: login command OK
サブスクリプションの確認
# azure account list
info: Executing command account list
data: Name Id Current State
data: ------------------------ ------------------------------------ ------- -------
data: Microsoft Azure エンタープライズ ############################### true Enabled
info: account list command OK
VMのイメージを探す
ここではCentOSのイメージを探してみる。
Azureポータル上からCentOS基本イメージの公開元(publishers)を調べたらOpenlogicと判明。
# azure vm image list japaneast Openlogic
info: Executing command vm image list
info: Getting virtual machine image offers (Publisher: "Openlogic" Location:"japaneast")
data: Publisher Offer Sku OS Version Location Urn
data: --------- ---------- ---- ----- ------------ --------- -------------------------------------
data: Openlogic CentOS 6.5 Linux 6.5.201501 japaneast Openlogic:CentOS:6.5:6.5.201501
data: Openlogic CentOS 6.5 Linux 6.5.201503 japaneast Openlogic:CentOS:6.5:6.5.201503
data: Openlogic CentOS 6.5 Linux 6.5.201506 japaneast Openlogic:CentOS:6.5:6.5.201506
data: Openlogic CentOS 6.5 Linux 6.5.20150904 japaneast Openlogic:CentOS:6.5:6.5.20150904
data: Openlogic CentOS 6.5 Linux 6.5.20160309 japaneast Openlogic:CentOS:6.5:6.5.20160309
data: Openlogic CentOS 6.6 Linux 6.6.201501 japaneast Openlogic:CentOS:6.6:6.6.201501
data: Openlogic CentOS 6.6 Linux 6.6.201503 japaneast Openlogic:CentOS:6.6:6.6.201503
data: Openlogic CentOS 6.6 Linux 6.6.201506 japaneast Openlogic:CentOS:6.6:6.6.201506
data: Openlogic CentOS 6.6 Linux 6.6.20150706 japaneast Openlogic:CentOS:6.6:6.6.20150706
data: Openlogic CentOS 6.6 Linux 6.6.20150731 japaneast Openlogic:CentOS:6.6:6.6.20150731
data: Openlogic CentOS 6.6 Linux 6.6.20160309 japaneast Openlogic:CentOS:6.6:6.6.20160309
data: Openlogic CentOS 6.7 Linux 6.7.20150815 japaneast Openlogic:CentOS:6.7:6.7.20150815
data: Openlogic CentOS 6.7 Linux 6.7.20160303 japaneast Openlogic:CentOS:6.7:6.7.20160303
data: Openlogic CentOS 6.7 Linux 6.7.20160310 japaneast Openlogic:CentOS:6.7:6.7.20160310
data: Openlogic CentOS 6.8 Linux 6.8.20160620 japaneast Openlogic:CentOS:6.8:6.8.20160620
data: Openlogic CentOS 6.8 Linux 6.8.20161026 japaneast Openlogic:CentOS:6.8:6.8.20161026
data: Openlogic CentOS 6.8 Linux 6.8.20170105 japaneast Openlogic:CentOS:6.8:6.8.20170105
data: Openlogic CentOS 7.0 Linux 7.0.20150128 japaneast Openlogic:CentOS:7.0:7.0.20150128
data: Openlogic CentOS 7.0 Linux 7.0.20150325 japaneast Openlogic:CentOS:7.0:7.0.20150325
data: Openlogic CentOS 7.0 Linux 7.0.20150605 japaneast Openlogic:CentOS:7.0:7.0.20150605
data: Openlogic CentOS 7.0 Linux 7.0.20150904 japaneast Openlogic:CentOS:7.0:7.0.20150904
data: Openlogic CentOS 7.0 Linux 7.0.20160309 japaneast Openlogic:CentOS:7.0:7.0.20160309
data: Openlogic CentOS 7.1 Linux 7.1.20150410 japaneast Openlogic:CentOS:7.1:7.1.20150410
data: Openlogic CentOS 7.1 Linux 7.1.20150605 japaneast Openlogic:CentOS:7.1:7.1.20150605
data: Openlogic CentOS 7.1 Linux 7.1.20150731 japaneast Openlogic:CentOS:7.1:7.1.20150731
data: Openlogic CentOS 7.1 Linux 7.1.20160308 japaneast Openlogic:CentOS:7.1:7.1.20160308
data: Openlogic CentOS 7.2 Linux 7.2.20160303 japaneast Openlogic:CentOS:7.2:7.2.20160303
data: Openlogic CentOS 7.2 Linux 7.2.20160308 japaneast Openlogic:CentOS:7.2:7.2.20160308
data: Openlogic CentOS 7.2 Linux 7.2.20160620 japaneast Openlogic:CentOS:7.2:7.2.20160620
data: Openlogic CentOS 7.2 Linux 7.2.20161026 japaneast Openlogic:CentOS:7.2:7.2.20161026
data: Openlogic CentOS 7.2 Linux 7.2.20170105 japaneast Openlogic:CentOS:7.2:7.2.20170105
data: Openlogic CentOS 7.2n Linux 7.2.20160629 japaneast Openlogic:CentOS:7.2n:7.2.20160629
data: Openlogic CentOS 7.3 Linux 7.3.20161221 japaneast Openlogic:CentOS:7.3:7.3.20161221
data: Openlogic CentOS-HPC 6.5 Linux 6.5.20160408 japaneast Openlogic:CentOS-HPC:6.5:6.5.20160408
data: Openlogic CentOS-HPC 7.1 Linux 7.1.20160408 japaneast Openlogic:CentOS-HPC:7.1:7.1.20160408
info: vm image list command OK