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
# Customer intent: I need to log the network traffic to and from a virtual machine (VM) so I can analyze it for anomalies.
@@ -20,10 +20,10 @@ This tutorial helps you use NSG flow logs to log a virtual machine's network tra
20
20
In this tutorial, you learn how to:
21
21
22
22
> [!div class="checklist"]
23
-
> * Create a virtual network and a Bastion host
23
+
> * Create a virtual network
24
24
> * Create a virtual machine with a network security group associated to its network interface
25
25
> * Register Microsoft.insights provider
26
-
> * Enable flow logging for a network security group using Network Watcher NSG flow logs
26
+
> * Enable flow logging for a network security group using Network Watcher flow logs
27
27
> * Download logged data
28
28
> * View logged data
29
29
@@ -35,11 +35,11 @@ In this tutorial, you learn how to:
35
35
36
36
Sign in to the [Azure portal](https://portal.azure.com).
37
37
38
-
## Create a virtual network and a Bastion host
38
+
## Create a virtual network
39
39
40
-
In this section, you create **myVNet** virtual network with two subnets and an Azure Bastion host. The first subnet is used for the virtual machine, and the second subnet is used for the Bastion host.
40
+
In this section, you create **myVNet** virtual network with one subnet for the virtual machine.
41
41
42
-
1. In the search box at the top of the portal, enter *virtual networks*. Select **Virtual networks**in the search results.
42
+
1. In the search box at the top of the portal, enter *virtual networks*. Select **Virtual networks**from the search results.
43
43
44
44
:::image type="content" source="./media/network-watcher-nsg-flow-logging-portal/virtual-network-azure-portal.png" alt-text="Screenshot shows searching for virtual networks in the Azure portal.":::
45
45
@@ -52,25 +52,7 @@ In this section, you create **myVNet** virtual network with two subnets and an A
52
52
| Resource Group | Select **Create new**. </br> Enter *myResourceGroup* in **Name**. </br> Select **OK**. |
53
53
|**Instance details**||
54
54
| Name | Enter *myVNet*. |
55
-
| Region | Select **East US**. |
56
-
57
-
1. Select the **Security** tab, or select the **Next** button at the bottom of the page.
58
-
59
-
1. Under **Azure Bastion**, select **Enable Azure Bastion** and accept the default values:
60
-
61
-
| Setting | Value |
62
-
| --- | --- |
63
-
| Azure Bastion host name |**myVNet-Bastion**. |
64
-
| Azure Bastion public IP Address |**(New) myVNet-bastion-publicIpAddress**. |
65
-
66
-
1. Select the **IP Addresses** tab, or select **Next** button at the bottom of the page.
67
-
68
-
1. Accept the default IP address space **10.0.0.0/16** and rename the **default** subnet by selecting the pencil icon next to it. In the **Edit subnet** page, enter the subnet name:
69
-
70
-
| Setting | Value |
71
-
| --- | --- |
72
-
|**Subnet details**||
73
-
| Name | Enter *mySubnet*. |
55
+
| Region | Select **(US) East US**. |
74
56
75
57
1. Select **Review + create**.
76
58
@@ -80,11 +62,11 @@ In this section, you create **myVNet** virtual network with two subnets and an A
80
62
81
63
In this section, you create **myVM** virtual machine.
82
64
83
-
1. In the search box at the top of the portal, enter *virtual machines*. Select **Virtual machines**in the search results.
65
+
1. In the search box at the top of the portal, enter *virtual machines*. Select **Virtual machines**from the search results.
84
66
85
-
2. Select **+ Create** and then select **Azure virtual machine**.
67
+
1. Select **+ Create** and then select **Azure virtual machine**.
86
68
87
-
3. In **Create a virtual machine**, enter or select the following values in the **Basics** tab:
69
+
1. In **Create a virtual machine**, enter or select the following values in the **Basics** tab:
88
70
89
71
| Setting | Value |
90
72
| --- | --- |
@@ -103,30 +85,34 @@ In this section, you create **myVM** virtual machine.
103
85
| Password | Enter a password. |
104
86
| Confirm password | Reenter password. |
105
87
106
-
4. Select the **Networking** tab, or select **Next: Disks**, then **Next: Networking**.
88
+
1. Select the **Networking** tab, or select **Next: Disks**, then **Next: Networking**.
107
89
108
-
5. In the Networking tab, select the following values:
90
+
1. In the Networking tab, select the following values:
109
91
110
92
| Setting | Value |
111
93
| --- | --- |
112
94
|**Network interface**||
113
95
| Virtual network | Select **myVNet**. |
114
96
| Subnet | Select **mySubnet**. |
115
-
| Public IP | Select **None**. |
97
+
| Public IP | Select **(new) myVM-ip**. |
116
98
| NIC network security group | Select **Basic**. This setting creates a network security group named **myVM-nsg** and associates it with the network interface of **myVM** virtual machine. |
117
-
| Public inbound ports | Select **None**. |
99
+
| Public inbound ports | Select **Allow selected ports**. |
100
+
| Select inbound ports | Select **RDP (3389)**. |
118
101
119
-
6. Select **Review + create**.
102
+
> [!CAUTION]
103
+
> Leaving the RDP port open to the internet is only recommended for testing. For production environments, it's recommended to restrict access to the RDP port to a specific IP address or range of IP addresses. You can also block internet access to the RDP port and use [Azure Bastion](../bastion/bastion-overview.md) to securely connect to your virtual machine from the Azure portal.
120
104
121
-
7. Review the settings, and then select **Create**.
105
+
1. Select **Review + create**.
106
+
107
+
1. Review the settings, and then select **Create**.
122
108
123
-
8. Once the deployment is complete, select **Go to resource** to go to the **Overview** page of **myVM**.
109
+
1. Once the deployment is complete, select **Go to resource** to go to the **Overview** page of **myVM**.
124
110
125
-
9. Select **Connect** then select **Bastion**.
111
+
1. Select **Connect** then select **RDP**.
126
112
127
-
10. Enter the username and password that you created in the previous steps. Leave **Open in new browser tab** checked.
113
+
1. Select **Download RDP File** and open the downloaded file.
128
114
129
-
11. Select **Connect**button.
115
+
1. Select **Connect**and then enter the username and password that you created in the previous steps. Accept the certificate if prompted.
130
116
131
117
## Register Insights provider
132
118
@@ -161,7 +147,7 @@ In this section, you create a storage account to use it to store the flow logs.
161
147
| Storage account name | Enter a unique name. This tutorial uses **mynwstorageaccount**. |
162
148
| Region | Select **(US) East US**. The storage account must be in the same region as the virtual machine and its network security group. |
163
149
| Performance | Select **Standard**. NSG flow logs only support Standard-tier storage accounts. |
| Redundancy | Select **Locally-redundant storage (LRS)** or different replication strategy that matches your durability requirements. |
165
151
166
152
1. Select the **Review** tab or select the **Review** button at the bottom.
167
153
@@ -205,9 +191,9 @@ In this section, you create an NSG flow log that's saved into the storage accoun
205
191
206
192
:::image type="content" source="./media/network-watcher-nsg-flow-logging-portal/flow-logs-list.png" alt-text="Screenshot of Flow logs page in the Azure portal showing the newly created flow log." lightbox="./media/network-watcher-nsg-flow-logging-portal/flow-logs-list.png":::
207
193
208
-
1. Go back to your browser tab of**myVM** virtual machine.
194
+
1. Go back to your RDP session with**myVM** virtual machine.
209
195
210
-
1.In **myVM**, open Microsoft Edge and go to `www.bing.com`.
196
+
1.Open Microsoft Edge and go to `www.bing.com`.
211
197
212
198
## Download the flow log
213
199
@@ -223,7 +209,9 @@ In this section, you go to the storage account you previously selected and downl
223
209
224
210
5. In the container, navigate the folder hierarchy until you get to the `PT1H.json` file. NSG log files are written to a folder hierarchy that follows the following naming convention:
6. Select the ellipsis **...** to the right of the PT1H.json file, then select **Download**.
229
217
@@ -285,23 +273,25 @@ The comma-separated information for **flowTuples** is as follows:
285
273
286
274
When no longer needed, delete **myResourceGroup** resource group and all of the resources it contains and **myVM-nsg-myResourceGroup-flowlog** flow log:
287
275
288
-
**Delete the flow log**:
276
+
**Delete the resource group**:
289
277
290
-
1. In the search box at the top of the portal, enter *network watcher*. Select **Network Watcher**in the search results.
278
+
1. In the search box at the top of the portal, enter ***myResourceGroup***. Select **myResourceGroup**from the search results.
291
279
292
-
1.Under**Logs**, select **Flow logs**.
280
+
1.Select**Delete resource group**.
293
281
294
-
1. In **Network Watcher | Flow logs**, select the checkbox of the flow log.
282
+
1. In **Delete a resource group**, enter ***myResourceGroup***, and then select **Delete**.
295
283
296
-
1. Select **Delete**.
284
+
1. Select **Delete** to confirm the deletion of the resource group and all its resources.
297
285
298
-
**Delete the resource group**:
286
+
**Delete the flow log**:
299
287
300
-
1. In the search box at the top of the portal, enter *myResourceGroup*. When you see **myResourceGroup**in the search results, select it.
288
+
1. In the search box at the top of the portal, enter ***network watcher***. Select **Network Watcher**from the search results.
301
289
302
-
1.Select**Delete resource group**.
290
+
1.Under**Logs**, select **Flow logs**.
303
291
304
-
1. Enter *myResourceGroup* for **TYPE THE RESOURCE GROUP NAME:** and select **Delete**.
292
+
1. In **Network Watcher | Flow logs**, select the checkbox of the flow log.
0 commit comments