azure cliコマンドをタブ補完できるようにする

◆ Live配信スケジュール ◆
サイオステクノロジーでは、Microsoft MVPの武井による「わかりみの深いシリーズ」など、定期的なLive配信を行っています。
⇒ 詳細スケジュールはこちらから
⇒ 見逃してしまった方はYoutubeチャンネルをご覧ください
【5/21開催】Azure OpenAI ServiceによるRAG実装ガイドを公開しました
生成AIを活用したユースケースで最も一番熱いと言われているRAGの実装ガイドを公開しました。そのガイドの紹介をおこなうイベントです!!
https://tech-lab.connpass.com/event/315703/

azure コマンドをタブ補完できるようにします。

事前準備

Azure CLIをインストールしている必要があります。
Azure CLI をインストール後、下記コマンドでloginして下さい。

$ azure login

タブ補完の有効化

Windows Azure CLIではMacとLinuxのAzureコマンドのタブ補完がサポートされています。

bashで利用する場合は下記コマンドを実行します。

  • macOS(login shell)の場合
azure --completion >> ~/azure.completion.sh
echo 'source ~/azure.completion.sh' >> ~/.bash_profile
  • Linux (non-login shell)の場合
azure --completion >> ~/azure.completion.sh
echo 'source ~/azure.completion.sh' >> ~/.bashrc

実際にやってみる

$ azure[tab]
azure
account           config            iothub            policy            role              vm
acs               datalake          keyvault          portal            servermanagement  vmss
ad                feature           lab               powerbi           servicefabric     vmssvm
appserviceplan    group             location          provider          storage           webapp
availset          hdinsight         login             quotas            tag
batch             help              logout            rediscache        telemetry
cdn               insights          network           resource          usage
$ azure n[tab]
$ azure network[tab]
application-gateway  lb                   nsg                  traffic-manager      vpn-connection
dns                  local-gateway        public-ip            usage                vpn-gateway
express-route        nic                  route-table          vnet
$ azure network dns record-set list -[tab]
--dns-zone-name   --resource-group  --type            -g                -v                -y
--json            --subscription    --verbose         -s                -vv               -z

-h でhelpを表示します。

$ azure network dns record-set list -h
help:    Get all record sets in a DNS zone
help:
help:    Usage: network dns record-set list [options]  
help:
help:    Options:
help:      -h, --help                             output usage information
help:      -v, --verbose                          use verbose output
help:      -vv                                    more verbose with debug output
help:      --json                                 use json output
help:      -g, --resource-group   the name of the resource group
help:      -z, --dns-zone-name     the name of the DNS zone
help:      -y, --type                       the type of the record set,
help:           If specified only record sets of this type will be listed.
help:           valid values are [A,AAAA,CNAME,MX,NS,PTR,SOA,SRV,TXT]
help:      -s, --subscription       the subscription identifier
help:
help:    Current Mode: arm (Azure Resource Management)

終わりに

azure コマンドのタブ補完の有効化する方法をご紹介いたしました。
少しでもazureライフを快適にしていただけたら、幸いです。

参考

Azure/azure-xplat-cli

アバター画像
About サイオステクノロジーの中の人です 88 Articles
サイオステクノロジーで働く中の人です。
ご覧いただきありがとうございます! この投稿はお役に立ちましたか?

役に立った 役に立たなかった

0人がこの投稿は役に立ったと言っています。


ご覧いただきありがとうございます。
ブログの最新情報はSNSでも発信しております。
ぜひTwitterのフォロー&Facebookページにいいねをお願い致します!



>> 雑誌等の執筆依頼を受付しております。
   ご希望の方はお気軽にお問い合わせください!

Be the first to comment

Leave a Reply

Your email address will not be published.


*


質問はこちら 閉じる