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: articles/virtual-machines/windows/quick-create-cli.md
+18-12Lines changed: 18 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ ms.service: virtual-machines
6
6
ms.collection: windows
7
7
ms.topic: quickstart
8
8
ms.workload: infrastructure
9
-
ms.date: 08/09/2021
9
+
ms.date: 02/23/2023
10
10
ms.author: cynthn
11
11
ms.custom: mvc, devx-track-azurecli, mode-api
12
12
---
@@ -27,28 +27,31 @@ To open the Cloud Shell, just select **Try it** from the upper right corner of a
27
27
28
28
## Create a resource group
29
29
30
-
Create a resource group with the [az group create](/cli/azure/group) command. An Azure resource group is a logical container into which Azure resources are deployed and managed. The following example creates a resource group named *myResourceGroup* in the *eastus* location:
30
+
Create a resource group with the [az group create](/cli/azure/group) command. An Azure resource group is a logical container into which Azure resources are deployed and managed. The following example creates a resource group named *myResourceGroup* in the *eastus* location. Replace the value of the `resourcegroup` variable as needed.
31
31
32
32
```azurecli-interactive
33
-
az group create --name myResourceGroup --location eastus
33
+
resourcegroup="West US 3"
34
+
az group create --name myResourceGroup --location $resourcegroup
34
35
```
35
36
36
37
## Create virtual machine
37
38
38
-
Create a VM with [az vm create](/cli/azure/vm). The following example creates a VM named *myVM*. This example uses *azureuser* for an administrative user name.
39
+
Create a VM with [az vm create](/cli/azure/vm). The following example creates a VM named *myVM*. This example uses *azureuser* for an administrative user name. Replace the values of the variables as needed.
39
40
40
-
You will need to supply a password that meets the [password requirements for Azure VMs](./faq.yml#what-are-the-password-requirements-when-creating-a-vm-
41
-
).
41
+
You will be prompted to supply a password that meets the [password requirements for Azure VMs](./faq.yml#what-are-the-password-requirements-when-creating-a-vm-
42
+
).
42
43
43
44
Using the example below, you will be prompted to enter a password at the command line. You could also add the the `--admin-password` parameter with a value for your password. The user name and password will be used later, when you connect to the VM.
44
45
45
46
```azurecli-interactive
47
+
vmname="myVM"
48
+
username="azureuser"
46
49
az vm create \
47
-
--resource-group myResourceGroup \
48
-
--name myVM \
50
+
--resource-group $resourcegroup \
51
+
--name $vmname \
49
52
--image Win2022AzureEditionCore \
50
53
--public-ip-sku Standard \
51
-
--admin-username azureuser
54
+
--admin-username $username
52
55
```
53
56
54
57
It takes a few minutes to create the VM and supporting resources. The following example output shows the VM create operation was successful.
@@ -74,15 +77,18 @@ Note your own `publicIpAddress` in the output from your VM. This address is used
74
77
To see your VM in action, install the IIS web server.
75
78
76
79
```azurecli-interactive
77
-
az vm run-command invoke -g MyResourceGroup -n MyVm --command-id RunPowerShellScript --scripts "Install-WindowsFeature -name Web-Server -IncludeManagementTools"
By default, only RDP connections are opened when you create a Windows VM in Azure. Use [az vm open-port](/cli/azure/vm) to open TCP port 80 for use with the IIS web server:
83
89
84
90
```azurecli-interactive
85
-
az vm open-port --port 80 --resource-group myResourceGroup --name myVM
91
+
az vm open-port --port 80 --resource-group $resourcegroup --name $vmname
86
92
```
87
93
88
94
## View the web server in action
@@ -96,7 +102,7 @@ With IIS installed and port 80 now open on your VM from the Internet, use a web
96
102
When no longer needed, you can use the [az group delete](/cli/azure/group) command to remove the resource group, VM, and all related resources:
0 commit comments