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/linux/quick-create-portal.md
+7-5Lines changed: 7 additions & 5 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: linux
7
7
ms.topic: quickstart
8
8
ms.workload: infrastructure
9
-
ms.date: 06/25/2020
9
+
ms.date: 12/13/2021
10
10
ms.author: cynthn
11
11
ms.custom: mvc, mode-ui
12
12
---
@@ -21,20 +21,22 @@ If you don't have an Azure subscription, create a [free account](https://azure.m
21
21
22
22
## Sign in to Azure
23
23
24
-
Sign in to the [Azure portal](https://portal.azure.com) if you haven't already.
24
+
Sign in to the [Azure portal](https://portal.azure.com).
25
25
26
26
## Create virtual machine
27
27
28
28
1. Type **virtual machines** in the search.
29
29
1. Under **Services**, select **Virtual machines**.
30
-
1. In the **Virtual machines** page, select **Add**. The **Create a virtual machine** page opens.
30
+
1. In the **Virtual machines** page, select **Create** and then **Virtual machine**. The **Create a virtual machine** page opens.
31
+
31
32
1. In the **Basics** tab, under **Project details**, make sure the correct subscription is selected and then choose to **Create new** resource group. Type *myResourceGroup* for the name.*.
32
33
33
34

34
35
35
-
1. Under **Instance details**, type *myVM* for the **Virtual machine name**, choose *East US* for your **Region**, and choose *Ubuntu 18.04 LTS* for your **Image**. Leave the other defaults.
36
+
1. Under **Instance details**, type *myVM* for the **Virtual machine name**, and choose *Ubuntu 18.04 LTS - Gen2* for your **Image**. Leave the other defaults. The default size and pricing is only shown as an example. Size availability and pricing is dependent on your region and subscription.
37
+
38
+
:::image type="content" source="media/quick-create-portal/instance-details.png" alt-text="Screenshot of the Instance details section where you provide a name for the virtual machine and select its region, image, and size.":::
36
39
37
-

38
40
39
41
1. Under **Administrator account**, select **SSH public key**.
# Quickstart: Create a Linux virtual machine in Azure with PowerShell
@@ -25,20 +25,6 @@ The Azure Cloud Shell is a free interactive shell that you can use to run the st
25
25
26
26
To open the Cloud Shell, just select **Try it** from the upper right corner of a code block. Select **Copy** to copy the blocks of code, paste it into the Cloud Shell, and press enter to run it.
27
27
28
-
## Create SSH key pair
29
-
30
-
Use [ssh-keygen](https://www.ssh.com/ssh/keygen/) to create an SSH key pair. If you already have an SSH key pair, you can skip this step.
31
-
32
-
33
-
```azurepowershell-interactive
34
-
ssh-keygen -t rsa -b 4096
35
-
```
36
-
37
-
You will be prompted to provide a filename for the key pair or you can hit **Enter** to use the default location of `/home/<username>/.ssh/id_rsa`. You will also be able to create a password for the keys, if you like.
38
-
39
-
For more detailed information on how to create SSH key pairs, see [How to use SSH keys with Windows](ssh-from-windows.md).
40
-
41
-
If you create your SSH key pair using the Cloud Shell, it will be stored in a [storage account that is automatically created by Cloud Shell](../../cloud-shell/persisting-shell-storage.md). Don't delete the storage account, or the files share in it, until after you have retrieved your keys or you will lose access to the VM.
42
28
43
29
## Create a resource group
44
30
@@ -48,146 +34,60 @@ Create an Azure resource group with [New-AzResourceGroup](/powershell/module/az.
Create a virtual network, subnet, and a public IP address. These resources are used to provide network connectivity to the VM and connect it to the internet:
# Create a public IP address and specify a DNS name
70
-
$pip = New-AzPublicIpAddress `
71
-
-ResourceGroupName "myResourceGroup" `
72
-
-Location "EastUS" `
73
-
-AllocationMethod Static `
74
-
-IdleTimeoutInMinutes 4 `
75
-
-Name "mypublicdns$(Get-Random)"
76
-
```
40
+
We will be automatically generating an SSH key pair to use for connecting to the VM. The public key that is created using `-GenerateSshKey` will be stored in Azure as a resource, using the name you provide as `SshKeyName`. The SSH key resource can be reused for creating additional VMs. Both the public and private keys will also downloaded for you. When you create your SSH key pair using the Cloud Shell, the keys are stored in a [storage account that is automatically created by Cloud Shell](../../cloud-shell/persisting-shell-storage.md). Don't delete the storage account, or the file share in it, until after you have retrieved your keys or you will lose access to the VM.
41
+
42
+
You will be prompted for a user name that will be used when you connect to the VM. You will also be asked for a password, which you can leave blank. Password login for the VM is disabled when using an SSH key.
77
43
78
-
Create an Azure Network Security Group and traffic rule. The Network Security Group secures the VM with inbound and outbound rules. In the following example, an inbound rule is created for TCP port 22 that allows SSH connections. To allow incoming web traffic, an inbound rule for TCP port 80 is also created.
44
+
In this example, you create a VM named *myVM*, in *East US*, using the *Standard_B2s* VM size.
79
45
80
46
```azurepowershell-interactive
81
-
# Create an inbound network security group rule for port 22
82
-
$nsgRuleSSH = New-AzNetworkSecurityRuleConfig `
83
-
-Name "myNetworkSecurityGroupRuleSSH" `
84
-
-Protocol "Tcp" `
85
-
-Direction "Inbound" `
86
-
-Priority 1000 `
87
-
-SourceAddressPrefix * `
88
-
-SourcePortRange * `
89
-
-DestinationAddressPrefix * `
90
-
-DestinationPortRange 22 `
91
-
-Access "Allow"
92
-
93
-
# Create an inbound network security group rule for port 80
94
-
$nsgRuleWeb = New-AzNetworkSecurityRuleConfig `
95
-
-Name "myNetworkSecurityGroupRuleWWW" `
96
-
-Protocol "Tcp" `
97
-
-Direction "Inbound" `
98
-
-Priority 1001 `
99
-
-SourceAddressPrefix * `
100
-
-SourcePortRange * `
101
-
-DestinationAddressPrefix * `
102
-
-DestinationPortRange 80 `
103
-
-Access "Allow"
104
-
105
-
# Create a network security group
106
-
$nsg = New-AzNetworkSecurityGroup `
107
-
-ResourceGroupName "myResourceGroup" `
108
-
-Location "EastUS" `
109
-
-Name "myNetworkSecurityGroup" `
110
-
-SecurityRules $nsgRuleSSH,$nsgRuleWeb
47
+
New-AzVm `
48
+
-ResourceGroupName "myResourceGroup" `
49
+
-Name "myVM" `
50
+
-Location "East US" `
51
+
-Image UbuntuLTS `
52
+
-size Standard_B2s `
53
+
-PublicIpAddressName myPubIP `
54
+
-OpenPorts 80,22 `
55
+
-GenerateSshKey `
56
+
-SshKeyName mySSHKey
111
57
```
112
58
113
-
Create a virtual network interface card (NIC) with [New-AzNetworkInterface](/powershell/module/az.network/new-aznetworkinterface). The virtual NIC connects the VM to a subnet, Network Security Group, and public IP address.
59
+
The output will give you the location of the local copy of the SSH key. For example:
114
60
115
-
```azurepowershell-interactive
116
-
# Create a virtual network card and associate with public IP address and NSG
117
-
$nic = New-AzNetworkInterface `
118
-
-Name "myNic" `
119
-
-ResourceGroupName "myResourceGroup" `
120
-
-Location "EastUS" `
121
-
-SubnetId $vnet.Subnets[0].Id `
122
-
-PublicIpAddressId $pip.Id `
123
-
-NetworkSecurityGroupId $nsg.Id
61
+
```output
62
+
Private key is saved to /home/user/.ssh/1234567891
63
+
Public key is saved to /home/user/.ssh/1234567891.pub
124
64
```
125
65
126
-
## Create a virtual machine
66
+
Make a note of the path to your private key to use later.
127
67
128
-
To create a VM in PowerShell, you create a configuration that has settings like the image to use, size, and authentication options. Then the configuration is used to build the VM.
68
+
It will take a few minutes for your VM to be deployed. When the deployment is finished, move on to the next section.
129
69
130
-
Define the SSH credentials, OS information, and VM size. In this example, the SSH key is stored in `~/.ssh/id_rsa.pub`.
Now, combine the previous configuration definitions to create with [New-AzVM](/powershell/module/az.compute/new-azvm):
73
+
You need to change the permission on the SSH key using `chmod`. Replace *~/.ssh/1234567891* in the following example with the private key name and path from the earlier output.
163
74
164
75
```azurepowershell-interactive
165
-
New-AzVM `
166
-
-ResourceGroupName "myResourceGroup" `
167
-
-Location eastus -VM $vmConfig
76
+
chmod 600 ~/.ssh/1234567891
168
77
```
169
78
170
-
It will take a few minutes for your VM to be deployed. When the deployment is finished, move on to the next section.
Create an SSH connection with the VM using the public IP address. To see the public IP address of the VM, use the [Get-AzPublicIpAddress](/powershell/module/az.network/get-azpublicipaddress) cmdlet:
Using the same shell you used to create your SSH key pair, paste the the following command into the shell to create an SSH session. Replace *10.111.12.123* with the IP address of your VM.
85
+
Using the same shell you used to create your SSH key pair, paste the the following command into the shell to create an SSH session. Replace *~/.ssh/1234567891* in the following example with the private key name and path from the earlier output. Replace *10.111.12.123* with the IP address of your VM and *azureuser* with the name you provided when you created the VM.
Copy file name to clipboardExpand all lines: articles/virtual-machines/windows/quick-create-portal.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,8 @@ Sign in to the Azure portal at https://portal.azure.com.
27
27
28
28
1. Type **virtual machines** in the search.
29
29
1. Under **Services**, select **Virtual machines**.
30
-
1. In the **Virtual machines** page, select **Create** then **Virtual machine**.
30
+
1. In the **Virtual machines** page, select **Create** and then **Virtual machine**. The **Create a virtual machine** page opens.
31
+
31
32
1. In the **Basics** tab, under **Project details**, make sure the correct subscription is selected and then choose to **Create new** resource group. Type *myResourceGroup* for the name.
32
33
33
34

0 commit comments