Azure CLI 参照コマンドを使用する場合、ほとんどのコマンドで使用できる引数があります。 これらの引数は、ほぼすべての Azure CLI 参照コマンドに共通するため、"グローバル パラメーター" と呼ばれます。
--help
グローバルパラメーター
参照グループまたはコマンドに関する情報を取得するには、 --help
グローバル パラメーターを使用します。
--help
パラメーターは、使用可能なサブグループとパラメーター リストを含む Azure CLI 参照情報をコンソールに表示します。
az group create --name myResourceGroup --location eastus --help
次に示すコンソール出力には、簡潔にするためにフィールドが省略されています。
Command
az group create : Create a new resource group.
Arguments
--location -l [Required] : Location. Values from: `az account list-locations`.
You can configure the default location using `az
configure --defaults location=<location>`.
--name --resource-group -g -n [Required] : Name of the new resource group.
--managed-by : The ID of the resource that manages this resource
group.
--tags : Space-separated tags: key[=value] [key[=value] ...].
Use "" to clear existing tags.
Global Arguments
--debug : Increase logging verbosity to show all debug logs.
--help -h : Show this help message and exit.
--only-show-errors : Only show errors, suppressing warnings.
Examples
Create a new resource group in the West US region.
az group create -l westus -n MyResourceGroup
--verbose
グローバルパラメーター
--verbose
グローバル パラメーターを参照コマンドに追加して、ログ記録の詳細を確認します。 詳細な出力は、ある特定のコマンドが他のコマンドよりも実行に時間がかかる理由を理解しようとする際に役立ちます。
az group create --name myResourceGroup --location eastus --verbose
次に示すコンソール出力には、簡潔にするためにフィールドが省略されていますが、実行時間に関する追加情報に注意してください。
{...}
Command ran in 1.413 seconds (init: 0.487, invoke: 0.926)
--debug
グローバル設定
--verbose
パラメーターの追加の詳細が十分ではなく、ログ全体を表示する場合は、--debug
グローバル パラメーターを使用します。 また、バグ レポートを送信するときに --debug
で生成された出力も提供します。
az group create --name myrResourceGroup --location eastus --debug
次に示すコンソール出力には、簡潔にするためにフィールドが省略されています。
cli.knack.cli: Command arguments: ['group', 'create', '--name', 'myResourceGroup', '--location', 'eastus', '--debug']
cli.knack.cli: __init__ debug log:
[...]
cli.knack.cli: Event: CommandInvoker.OnTransformResult [<function _resource_group_transform at 0x000001D9B72123B0>, <function _x509_from_base64_to_hex_transform at 0x000001D9B7212440>]
cli.knack.cli: Event: CommandInvoker.OnFilterResult []
{...}
[...]
telemetry.process: Return from creating process
telemetry.main: Finish creating telemetry upload process.
--only-show-errors
グローバル パラメーター
デバッグの処理中に、 --only-show-errors
グローバル パラメーターを使用して、参照コマンドによって返される警告を削除します。
az interactive
出力コンソール:
**This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus**
Any comments or concerns? You can use the 'feedback' command! We would greatly appreciate it.
A new Recommender is added which can make the completion ability more intelligent and provide the scenario completion!
If you want to disable this feature, you can use 'az config set interactive.enable_recommender=False' to disable it.
A command preload mechanism was added to prevent lagging and command run errors.
You can skip preloading in a single pass by CTRL+C or turn it off by setting 'az config set interactive.enable_preloading=False'
Loading command table... Expected time around 1 minute.
--subscription
グローバルパラメーター
--subscription
グローバル パラメーターを使用して、コマンドの特定のサブスクリプションを設定できます。 次の例では、サブスクリプション ID を使用してアクティブなサブスクリプションを変更します。
az account set --subscription "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
--output
global パラメーター
コマンドの出力を特定の形式で表示するには、 --output
グローバル パラメーターを指定します。 この例では、出力がテーブルとして表示されます。
注意
出力に使用できる値は、json、jsonc、none、table、tsv、yaml、および yamlc です。 既定の出力値は json です。
az vm list --resource-group myResourceGroup --output table
出力コンソール:
Name ResourceGroup Location
------ --------------- ----------
myVm myResourceGroup eastus
さまざまな出力形式の詳細については、「Azure CLI コマンドの出力形式を参照してください。
--query
global パラメーター
フィルター処理が必要な大量の情報が出力コンソールに表示される場合があります。 そのためには、 --query
グローバル パラメーターを使用して、コマンドの結果に対して JMESPath クエリ を実行します。 JMESPath は JSON のクエリ言語であり、Azure CLI 出力からデータを選択および変更できます。
次の例では、 --query
を追加して、仮想マシンへの接続が承認された SSH 公開キーを返します。
az vm show --resource-group myResourceGroup --name myVm --query "osProfile.linuxConfigurat
ion.ssh.publicKeys"
出力コンソール:
[
{
"keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7WbiMEsB0iwdGPjeGXs3UWFtzbCkUwtIxzkIOpEtlqkLGa0XQdvwhzok6szq6Ycx/f4cfid/yrmBPtzmxdQnGeCy2FOcVIzp+SkjIUg/Ez2YyDcMb60u66QUmHPRyhipJ/PDZROt6O0092qfTkTjB+7hLRiZzV2raLjiQ95eV0AXUP+Gsvdo/7ytqWNIm3iQTWbQ/GwSg+p0v+kmZELIbrxo845dambSpgBL8g0wCUZaptru3ZHo9m0UWbFPASVJKauhfPCSVPQCaOCaAdB01Ih8QDVRCazT+jyV6GgTwUIXVQthVBbt56ibhuSUdf0cWF8IVncjH+WXexVAhQw0j",
"path": "/home/yourName/.ssh/authorized_keys"
}
]
コマンド出力のクエリの詳細については、「 JMESPath クエリを使用して Azure CLI コマンド出力を照会する方法を参照してください。
関連項目
Azure CLI