You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/authoring_command_modules/authoring_commands.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ Authoring Commands
39
39
40
40
## Write the Command Loader
41
41
42
-
As of version 2.0.24, Azure CLI is based on the Knack framework (https://github.com/Microsoft/knack), which uses the `CLICommandsLoader` class as the mechanism for loading a module. In Azure CLI 2.0, you will create your own loader which will inherit from the `AzCommandsLoader` class. The basic structure is:
42
+
As of version 2.0.24, Azure CLI is based on the Knack framework (https://github.com/Microsoft/knack), which uses the `CLICommandsLoader` class as the mechanism for loading a module. In Azure CLI, you will create your own loader which will inherit from the `AzCommandsLoader` class. The basic structure is:
43
43
44
44
```Python
45
45
classMyCommandsLoader(AzCommandsLoader):
@@ -289,9 +289,9 @@ Additional Topics
289
289
290
290
## Keyword Argument Reference
291
291
292
-
**Overview of Keyword Arguments in Azure CLI 2.0**
292
+
**Overview of Keyword Arguments in the Azure CLI**
293
293
294
-
When writing commands for Azure CLI 2.0, it is important to understand how keyword arguments (kwargs) are applied. Refer to the following diagram.
294
+
When writing commands for the Azure CLI, it is important to understand how keyword arguments (kwargs) are applied. Refer to the following diagram.
295
295
296
296

297
297
@@ -366,7 +366,7 @@ The following kwargs may be inherited from the command loader:
366
366
367
367
Most ARM resources can be identified by an ID. In many cases, for example `show` and `delete` commands, it may be more useful to copy and paste an ID to identify the target resource instead of having to specify the names of the resource group, the resource, and the parent resource (if any).
368
368
369
-
Azure CLI 2.0 supports exposing an `--ids` parameter that will parse a resource ID into its constituent named parts so that this parsing need not be done as part of a client script. Additionally `--ids` will accept a _list_ of space-separated IDs, allowing the client to loop the command over each ID.
369
+
Azure CLI supports exposing an `--ids` parameter that will parse a resource ID into its constituent named parts so that this parsing need not be done as part of a client script. Additionally `--ids` will accept a _list_ of space-separated IDs, allowing the client to loop the command over each ID.
370
370
371
371
Enabling this functionality only requires the command author specify the appropriate values for `id_part` in their calls to `AzArgumentContext.argument`.
Copy file name to clipboardExpand all lines: doc/classic_cli_migration.md
+35-33Lines changed: 35 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,21 @@
1
-
# Migrating from Azure XPlat CLI to Azure CLI 2.0
1
+
# Migrating from Azure classic CLI to Azure CLI
2
2
3
-
With the introduction of our Azure CLI 2.0 preview, customers now have a
4
-
choice of Azure command-line tools. While our Azure CLI 2.0 is built to be
5
-
easier to use and automate, please consider the following before starting:
3
+
If you still use the original Azure classic CLI for your scripts and deployments,
4
+
you should consider switching to the new Azure CLI. Azure CLI is designed
5
+
for working with the Resource Manager deployment style, while Azure classic CLI
6
+
is recommended for only the classic (Azure Service Manager) deployment.
6
7
7
-
* Both Azure CLI's can be installed and used side-by-side
8
-
* The Azure CLI 2.0 will not support ASM/Classic mode services
8
+
If you are ready to switch, please consider the following before starting:
9
+
10
+
* Both Azure CLIs can be installed and used side-by-side
11
+
* The Azure CLI will not support ASM/Classic mode services
9
12
* Scripts are not compatible between both CLIs
10
13
11
-
## Why consider trying the Azure CLI 2.0?
12
-
Regardless of the tool or vendor, it is important to ensure you benefit when
13
-
adding a new tool to your toolbox. While the following covers only a small
14
-
number of difference between these two products, we expect customers to benefit
15
-
from the following:
14
+
## Why switch?
15
+
16
+
The major reason to switch is that Azure classic CLI is currently only planned
17
+
to have support through the end of 2018. The new Azure CLI also offers the following
18
+
benefits:
16
19
17
20
* Clean outputs for common workflows
18
21
*`--out table` for simplified human output
@@ -26,29 +29,27 @@ from the following:
26
29
* Use `[tab][tab]` to lookup parameters, including resource groups and names (only supported in BASH and BASH on Windows)
27
30
* Work with either Azure resource ID values (`--ids`) _or_ resource group and name (`-g -n`)
28
31
* Built in client-side query engine powered by JMESPath
29
-
* Service support
30
-
* Our preview meets or exceeds XPlat CLI functionality for Compute, Storage, Network, RBAC, and ARM
31
-
* More services coming online soon!
32
32
33
33
While we believe the above list is compelling, it's important to remember
34
-
**the Azure CLI 2.0 only supports ARM mode**. If you are managing ASM/Classic
35
-
resources, you must use the Azure XPlat CLI.
34
+
**the Azure CLI only supports ARM mode**. If you are managing ASM/Classic
35
+
resources, you must use the Azure classic CLI.
36
36
37
-
## Getting both CLI's setup side-by-side
37
+
## Getting both CLIs set up side-by-side
38
38
39
-
First, you run `azure --version` and ensure you are using `0.10.5` or later, as
39
+
First, run `azure --version` and ensure you are using `0.10.5` or later, as
40
40
this is required for sharing your credentials between both CLIs. If you installed
41
41
using NPM, upgrade with `npm upgrade -g azure-cli`. If you used an installer,
42
42
we recommend downloading the latest installer to upgrade.
43
43
44
-
To install the Azure CLI 2.0, follow the steps for your preferred platform or
45
-
environment on our [Installation Guide](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli).
44
+
To install the latest Azure CLI, follow the steps for your preferred platform or
45
+
environment in our [Installation Guide](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli).
46
46
47
-
Once installed, you can run `az configure` and follow the steps to setup your default output format.
47
+
Once installed, you run `az configure` and follow the steps to setup your default output format.
48
48
49
49
Then run `az login` to login using device authentication. Once this step is complete you should be authenticated to use both CLIs.
50
50
51
-
## Important new concepts in the Azure CLI 2.0
51
+
## Important new concepts in the Azure CLI
52
+
52
53
Here is a quick list of some new and changed concepts that can help you understand the new tool.
53
54
54
55
* Interactive Concepts
@@ -63,9 +64,9 @@ Here is a quick list of some new and changed concepts that can help you understa
63
64
* Service Specific Concepts
64
65
* VM power state is no longer included in `az vm list`, use `az vm get-instance-view` instead
65
66
66
-
## Moving scripts from XPlat CLI to Azure CLI 2.0
67
+
## Moving scripts from Azure classic CLI to Azure CLI
67
68
68
-
Generally, converting a script from XPlat to Az follows these steps:
69
+
Generally, converting a script from Azure classic CLI to Azure CLI follows these steps:
69
70
70
71
1. Switch `azure` commands to `az` commands
71
72
2. Update commands to use new input values
@@ -76,19 +77,20 @@ Below, we break down each of these steps.
76
77
77
78
### Finding and switching to `az` commands
78
79
79
-
While most commands keep the same group and command names between the Azure XPlat CLI and the Azure CLI 2.0, we've built a [azure to az conversion table](https://github.com/Azure/azure-cli/blob/master/doc/azure2az_commands.rst) for common commands.
80
+
While most commands keep the same group and command names between the Azure classic CLI and the latest Azure CLI, we've built a
81
+
[azure to az conversion table](https://github.com/Azure/azure-cli/blob/master/doc/azure2az_commands.rst) for common commands.
80
82
81
83
#### Set vs. Update
82
84
83
-
Mutate operations now use the `update` verb instead of `set`. While the XPlat CLI
85
+
Mutate operations now use the `update` verb instead of `set`. While the classic CLI
84
86
exposed some common operations as parameters, such as:
85
87
86
88
```
87
89
$ azure vm set -g MyGroup -n MyName --nic-ids $MyNicID
88
90
$ azure vm set -g MyGroup -n MyName --tags myTagName=MyTagValue
89
91
```
90
92
91
-
The Azure CLI 2.0 `update` commands work generically against the resource, for example:
93
+
The Azure CLI `update` commands work generically against the resource, for example:
92
94
```
93
95
$ az vm update -g MyGroup -n MyName --add networkProfile.networkInterfaces primary=false id=$MyNicID
94
96
$ az vm update -g MyGroup -n MyName --set tags.myTagName=MyTagValue
@@ -106,8 +108,8 @@ An example of this is `azure storage cors set` being replaced by `az storage cor
106
108
### Updating input values
107
109
108
110
Once you have identified the `az` commands required for your script, you immediately
109
-
notice changes to how inputs are handled. The Azure CLI 2.0 does not accept
110
-
'positional parameters' such as `azure vm show MyRG MyName`, but instead require
111
+
notice changes to how inputs are handled. The Azure CLI does not accept
112
+
'positional parameters' such as `azure vm show MyRG MyName`, but instead requires
111
113
parameter flags: `az vm show -g MyRG -n MyName`.
112
114
113
115
In addition, when an input value is missing, we will show an error indicating the
@@ -118,7 +120,7 @@ $ az vm show
118
120
az vm show: error: (--name --resource-group | --ids) are required
119
121
```
120
122
121
-
In addition to using resource groups and names (`-g-n`), you can also refer to
123
+
In addition to using resource groups and names (`-g`, `-n`), you can also refer to
122
124
resources directly by ID value using `--ids`:
123
125
124
126
```
@@ -141,7 +143,7 @@ $ az role create --role-definition @MyOnCallRoleDef.json
141
143
142
144
### Working with output formats
143
145
144
-
The Azure CLI 2.0 supports 4 primary output formats:
146
+
The Azure CLI supports 4 primary output formats:
145
147
146
148
1. json - standard JSON formatted object graphs
147
149
2. jsonc - colorized JSON
@@ -170,7 +172,7 @@ VM-Data
170
172
171
173
### Filtering down output values
172
174
173
-
A common pattern in Azure XPlat CLI scripts is using command-line tools, such as
175
+
A common pattern in Azure classic CLI scripts is using command-line tools, such as
174
176
AWK, grep, and jq, to extract values from output documents:
175
177
176
178
```
@@ -184,7 +186,7 @@ $ azure vm list --json \
184
186
$ MY_SUBSCRIPTION_ID=$(azure account show --json | jq -r '.[0].id')
185
187
```
186
188
187
-
With the Azure CLI 2.0, you can now use the `--query '[expression]'` parameter and the [JMESPath](http://jmespath.org/)
189
+
With the Azure CLI, you can now use the `--query '[expression]'` parameter and the [JMESPath](http://jmespath.org/)
0 commit comments