<commit_before># Migrating from Azure XPlat CLI to Azure CLI 2.0

With the introduction of our Azure CLI 2.0 preview, customers now have a
choice of Azure command-line tools.  While our Azure CLI 2.0 is built to be
easier to use and automate, please consider the following before starting:

* Both Azure CLI's can be installed and used side-by-side
* The Azure CLI 2.0 will not support ASM/Classic mode services
* Scripts are not compatible between both CLIs

## Why consider trying the Azure CLI 2.0?
Regardless of the tool or vendor, it is important to ensure you benefit when
adding a new tool to your toolbox.  While the following covers only a small
number of difference between these two products, we expect customers to benefit
from the following:

* Clean outputs for common workflows
  * `--out table` for simplified human output
  * `--out json` and `--out jsonc` for JSON outputs
  * `--out tsv` for interacting with tools like grep, AWK, and jq
* Improved and consistent in-tool documentation with `-h`
  * Includes descriptions for groups, commands, and parameters
  * Indicates where to look up required values
  * Examples and links to web content
* Improved command-line productivity
  * Use `[tab][tab]` to lookup parameters, including resource groups and names (only supported in BASH and BASH on Windows)
  * Work with either Azure resource ID values (`--ids`) _or_ resource group and name (`-g -n`)
  * Built in client-side query engine powered by JMESPath
* Service support
  * Our preview meets or exceeds XPlat CLI functionality for Compute, Storage, Network, RBAC, and ARM
  * More services coming online soon!

While we believe the above list is compelling, it's important to remember
**the Azure CLI 2.0 only supports ARM mode**.  If you are managing ASM/Classic 
resources, you must use the Azure XPlat CLI.

## Getting both CLI's setup side-by-side

First, you run `azure --version` and ensure you are using `0.10.5` or later, as
this is required for sharing your credentials between both CLIs.  If you installed
using NPM, upgrade with `npm upgrade -g azure-cli`.  If you used an installer,
we recommend downloading the latest installer to upgrade.

To install the Azure CLI 2.0, follow the steps for your preferred platform or
environment on our [Installation Guide](https://github.com/Azure/azure-cli/blob/master/README.rst#installation).

Once installed, you can run `az configure` and follow the steps to setup your default output format.  

Then run `az login` to login using device authentication.  Once this step is complete you should be authenticated to use both CLIs.  

## Important new concepts in the Azure CLI 2.0
Here is a quick list of some new and changed concepts that can help you understand the new tool.

* Interactive Concepts
  * Use `az configure` to setup your default output format
  * You will find help to be generally more useful, try `az vm create -h` for an example
  * Positional parameters are not supported, use `az vm list -g MyGroup` instead of `azure vm list MyGroup`
* Automation and Scripting Concepts
  * You can refer to resources using their Azure resource ID with `--ids` or with the resource group and name using `-g [rg] -n [name]`
  * Use `--query "[expression]"` to extract single values
  * Use `--out tsv` to get plain (no mark-up) value output
  * Use `@-` to pipe values such as `az vm list --query [0].[id] --out tsv | az vm show --ids @-`
* Service Specific Concepts
  * VM power state is no longer included in `az vm list`, use `az vm get-instance-view` instead

## Moving scripts from XPlat CLI to Azure CLI 2.0

Generally, converting a script from XPlat to Az follows these steps:

1. Switch `azure` commands to `az` commands
2. Update commands to use new input values
3. Update script to use new output formats
4. Use `--query` to extract values reliably<commit_msg>Update link to let the server handle redirect (+1 squashed commit) (#6054)<commit_after># Migrating from Azure XPlat CLI to Azure CLI 2.0

With the introduction of our Azure CLI 2.0 preview, customers now have a
choice of Azure command-line tools.  While our Azure CLI 2.0 is built to be
easier to use and automate, please consider the following before starting:

* Both Azure CLI's can be installed and used side-by-side
* The Azure CLI 2.0 will not support ASM/Classic mode services
* Scripts are not compatible between both CLIs

## Why consider trying the Azure CLI 2.0?
Regardless of the tool or vendor, it is important to ensure you benefit when
adding a new tool to your toolbox.  While the following covers only a small
number of difference between these two products, we expect customers to benefit
from the following:

* Clean outputs for common workflows
  * `--out table` for simplified human output
  * `--out json` and `--out jsonc` for JSON outputs
  * `--out tsv` for interacting with tools like grep, AWK, and jq
* Improved and consistent in-tool documentation with `-h`
  * Includes descriptions for groups, commands, and parameters
  * Indicates where to look up required values
  * Examples and links to web content
* Improved command-line productivity
  * Use `[tab][tab]` to lookup parameters, including resource groups and names (only supported in BASH and BASH on Windows)
  * Work with either Azure resource ID values (`--ids`) _or_ resource group and name (`-g -n`)
  * Built in client-side query engine powered by JMESPath
* Service support
  * Our preview meets or exceeds XPlat CLI functionality for Compute, Storage, Network, RBAC, and ARM
  * More services coming online soon!

While we believe the above list is compelling, it's important to remember
**the Azure CLI 2.0 only supports ARM mode**.  If you are managing ASM/Classic 
resources, you must use the Azure XPlat CLI.

## Getting both CLI's setup side-by-side

First, you run `azure --version` and ensure you are using `0.10.5` or later, as
this is required for sharing your credentials between both CLIs.  If you installed
using NPM, upgrade with `npm upgrade -g azure-cli`.  If you used an installer,
we recommend downloading the latest installer to upgrade.

To install the Azure CLI 2.0, follow the steps for your preferred platform or
environment on our [Installation Guide](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli).

Once installed, you can run `az configure` and follow the steps to setup your default output format.  

Then run `az login` to login using device authentication.  Once this step is complete you should be authenticated to use both CLIs.  

## Important new concepts in the Azure CLI 2.0
Here is a quick list of some new and changed concepts that can help you understand the new tool.

* Interactive Concepts
  * Use `az configure` to setup your default output format
  * You will find help to be generally more useful, try `az vm create -h` for an example
  * Positional parameters are not supported, use `az vm list -g MyGroup` instead of `azure vm list MyGroup`
* Automation and Scripting Concepts
  * You can refer to resources using their Azure resource ID with `--ids` or with the resource group and name using `-g [rg] -n [name]`
  * Use `--query "[expression]"` to extract single values
  * Use `--out tsv` to get plain (no mark-up) value output
  * Use `@-` to pipe values such as `az vm list --query [0].[id] --out tsv | az vm show --ids @-`
* Service Specific Concepts
  * VM power state is no longer included in `az vm list`, use `az vm get-instance-view` instead

## Moving scripts from XPlat CLI to Azure CLI 2.0

Generally, converting a script from XPlat to Az follows these steps:

1. Switch `azure` commands to `az` commands
2. Update commands to use new input values
3. Update script to use new output formats
4. Use `--query` to extract values reliably
{'fraction_non_alphanumeric': 0.06653771760154739, 'fraction_numerical': 0.007607994842037395, 'mean_word_length': 3.9244444444444446, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3364843', 'n_tokens_mistral': 2155, 'n_tokens_neox': 2038, 'n_words': 1198}