LoginSignup
5
3

More than 5 years have passed since last update.

Azure Powershellユーザ向けAzure CLI 2.0コマンド対応表

Last updated at Posted at 2017-06-07

はじめに

Azure Cloud Shellが登場して、Azureポータルから気軽にshellコマンドが叩ける用になりました。
本記事執筆時点(2017/06/07)では、まだPreviewとなっており使えるShellはBashとなっています。

こちらのBashですが標準でAzure CLI 2.0がインストール済みなのですぐにazコマンドが利用可能です(Azure CLI Interactive Modeも利用可能!)

自身もAzureポータル以外ではAzure Powershellを使って仮想マシンのデプロイ等を行っているのですが、私がよく使うAzure PowershellのコマンドとAzure CLI 2.0のコマンド対応表を作ったので公開します。

対応表

以下の通りです。

コマンド内容 Azure Powershell Azure CLI 2.0
ログイン Add-AzureRmAccount(Login-AzureRmAccount) az login
サブスクリプション一覧 Get-AzureRmSubscription az account list -o table
サブスクリプション選択 Select-AzureRmSubscription -Subsctiption-Id XXXXXXXX az account set --subscription XXXXXXXX
VM一覧 Get-AzureRmVM az vm list -o table
VM停止 Stop-AzureRmVM -ResourceGroupName <RGNAME> -Name <VMNAME> az vm stop --resource-group <RGNAME> --name <VMNAME>
リソースグループ一覧 Get-AzureRmResourceGroup az group list -o table
リソースグループ作成 New-AzureRmResourceGroup -Name <RGNAME> -Location <REGION> az group create --name <RGNAME> -location <REGION>
テンプレートファイルからのデプロイ New-AzureRmResourceGroupDeployment -TemplateParameterFile <PARAMETER.json> -TemplateFile <TEMPLATE.json> -ResourceGroupName <RGNAME> az group deployment create --parameters @<PARAMETER.json> --template-file <TEMPLATE.json> --resource-group <RGNAME>

おわりに

とりあえずJSONテンプレート自作派の方であれば上記コマンドでなんとかなるのでは。
適宜一覧は更新していきます。

5
3
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
5
3