Skip to content

Commit 8d68884

Browse files
Merge pull request #283642 from naman-msft/docs-editor/quick-create-cli-1722891539
Update quick-create-cli.md
2 parents c420307 + c3f8fee commit 8d68884

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

articles/virtual-machines/linux/quick-create-cli.md

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,6 @@ To open the Cloud Shell, just select **Try it** from the upper right corner of a
2828

2929
If you prefer to install and use the CLI locally, this quickstart requires Azure CLI version 2.0.30 or later. Run `az --version` to find the version. If you need to install or upgrade, see [Install Azure CLI]( /cli/azure/install-azure-cli).
3030

31-
## Define environment variables
32-
33-
The first step is to define the environment variables. Environment variables are commonly used in Linux to centralize configuration data to improve consistency and maintainability of the system. Create the following environment variables to specify the names of resources that you create later in this tutorial:
34-
35-
```bash
36-
export RANDOM_ID="$(openssl rand -hex 3)"
37-
export MY_RESOURCE_GROUP_NAME="myVMResourceGroup$RANDOM_ID"
38-
export REGION=EastUS
39-
export MY_VM_NAME="myVM$RANDOM_ID"
40-
export MY_USERNAME=azureuser
41-
export MY_VM_IMAGE="Canonical:0001-com-ubuntu-minimal-jammy:minimal-22_04-lts-gen2:latest"
42-
```
43-
4431
## Log in to Azure using the CLI
4532

4633
In order to run commands in Azure using the CLI, you need to log in first. Log in using the `az login` command.
@@ -50,6 +37,9 @@ In order to run commands in Azure using the CLI, you need to log in first. Log i
5037
A resource group is a container for related resources. All resources must be placed in a resource group. The [az group create](/cli/azure/group) command creates a resource group with the previously defined $MY_RESOURCE_GROUP_NAME and $REGION parameters.
5138

5239
```bash
40+
export RANDOM_ID="$(openssl rand -hex 3)"
41+
export MY_RESOURCE_GROUP_NAME="myVMResourceGroup$RANDOM_ID"
42+
export REGION=EastUS
5343
az group create --name $MY_RESOURCE_GROUP_NAME --location $REGION
5444
```
5545

@@ -79,6 +69,9 @@ The following example creates a VM and adds a user account. The `--generate-ssh-
7969
All other values are configured using environment variables.
8070

8171
```bash
72+
export MY_VM_NAME="myVM$RANDOM_ID"
73+
export MY_USERNAME=azureuser
74+
export MY_VM_IMAGE="Canonical:0001-com-ubuntu-minimal-jammy:minimal-22_04-lts-gen2:latest"
8275
az vm create \
8376
--resource-group $MY_RESOURCE_GROUP_NAME \
8477
--name $MY_VM_NAME \

0 commit comments

Comments
 (0)