AzureCLIのインストール
公式ダウンロードからインストーラーを落としてきてインストールするのが簡単だと思います。
インストールが終わったら、とりあえずazureコマンド叩いてみましょう。
info: _ _____ _ ___ ___
info: /_\ |_ / | | | _ \ __|
info: _ ___/ _ \__/ /| |_| | / _|___ _ _
info: (___ /_/ \_\/___|\___/|_|_\___| _____)
info: (_______ _ _) _ ______ _)_ _
info: (______________ _ ) (___ _ _)
info:
info: Microsoft Azure: Microsoft's Cloud Platform
info:
info: Tool version 0.9.15
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: Commands:
help: account Commands to manage your account information and publish settings
help: ad Commands to display active directory objects
help: apiapp Commands to manage ApiApps
help: availset Commands to manage your availablilty sets
help: config Commands to manage your local settings
help: datalake Commands to manage your Data Lake objects
help: feature Commands to manage your features
help: group Commands to manage your resource groups
help: hdinsight Commands to manage HDInsight clusters and jobs
help: insights Commands related to monitoring Insights (events, alert rules, autoscale settings, metrics)
help: keyvault Commands to manage key vault instances in the Azure Key Vault service
help: location Commands to get the available locations
help: network Commands to manage network resources
help: provider Commands to manage resource provider registrations
help: rediscache Commands to manage your Azure Redis Cache(s)
help: resource Commands to manage your resources
help: role Commands to manage role definitions
help: storage Commands to manage your Storage objects
help: tag Commands to manage your resource manager tags
help: usage Command to view your aggregated Azure usage data
help: vm Commands to manage your virtual machines
help: webapp Commands to manage your Azure webapps
help:
help: Options:
help: -h, --help output usage information
help: -v, --version output the application version
help:
help: Current Mode: arm (Azure Resource Management)
という感じでコマンド一覧も確認できるのですが…
ネットで調べると出てくるようなコマンドが無いorz
ちなみに以前のバージョンのAzureCLIだと
info: _ _____ _ ___ ___
info: /_\ |_ / | | | _ \ __|
info: _ ___/ _ \__/ /| |_| | / _|___ _ _
info: (___ /_/ \_\/___|\___/|_|_\___| _____)
info: (_______ _ _) _ ______ _)_ _
info: (______________ _ ) (___ _ _)
info:
info: Microsoft Azure: Microsoft's Cloud Platform
info:
info: Tool version 0.9.8
help:
help: Display help for a given command
help: help [options] [command]
help:
help: Log in to an Azure subscription using Active Directory. Currently, the user can login only via Microsoft organizational account
help: login [options] [username]
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: Commands:
help: account Commands to manage your account information and publish settings
help: config Commands to manage your local settings
help: hdinsight Commands to manage HDInsight clusters and jobs
help: mobile Commands to manage your Mobile Services
help: network Commands to manage your networks
help: sb Commands to manage your Service Bus configuration
help: service Commands to manage your Cloud Services
help: site Commands to manage your Web Sites
help: sql Commands to manage your SQL Server accounts
help: storage Commands to manage your Storage objects
help: vm Commands to manage your Virtual Machines
help:
help: Options:
help: -h, --help output usage information
help: -v, --version output the application version
help:
help: Current Mode: asm (Azure Service Management)
機能やServiceが増えているのでコマンドも変わっていくのでしょう^^;;;
Azureサブスクリプションへ接続
「Azure コマンド ライン インターフェイス (Azure CLI) からの Azure サブスクリプションへの接続」にかかれているのですが、AzureCLI ver.0.9.10以降だと対話型のazure login
コマンドを使って任意のIDにログインできるようになったとのこと。
ver.0.9.9以降は多要素認証をサポートしています。
対話型ログイン
loginコマンドを叩いてみると
$ azure login
info: Executing command login
info: To sign in, use a web browser to open the page https://aka.ms/devicelogin. Enter the code XXXXXXXXX to authenticate.
といった指示が出るので、ブラウザでhttps://aka.ms/deviceloginを開いてXXXXXXXXXの部分に表示されているコードを入力する。
コード入力後、一呼吸いれたぐらいで
info: Added subscription Microsoft Azure エンタープライズ
+
info: login command OK
ログイン完了の表示になる。
これで色々と操作をする準備ができました(多分…)