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/azure-resource-manager/bicep/scenarios-virtual-networks.md
+3-57Lines changed: 3 additions & 57 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Create virtual network resources by using Bicep
3
3
description: Describes how to create virtual networks, network security groups, and route tables by using Bicep.
4
4
ms.topic: conceptual
5
5
ms.custom: devx-track-bicep
6
-
ms.date: 04/02/2025
6
+
ms.date: 04/25/2025
7
7
---
8
8
9
9
# Create virtual network resources by using Bicep
@@ -21,7 +21,7 @@ Virtual networks contain subnets, which are logical groupings of IP addresses wi
21
21
> [!NOTE]
22
22
> The Azure Virtual Network API is updated to allow modifications to virtual networks without requiring the inclusion of the subnet property in PUT requests. Previously, omitting the subnet property would result in the deletion of existing subnets. With the new behavior, if the subnet property isn't included in a PUT request, the existing subnets remain unchanged. Explicitly setting the subnet property to an empty value deletes all existing subnets, while providing specific subnet configurations creates or updates subnets accordingly. This change simplifies virtual network management by preventing unintended subnet deletions during updates. For more information, see [Azure Virtual Network now supports updates without subnet property](https://techcommunity.microsoft.com/blog/azurenetworkingblog/azure-virtual-network-now-supports-updates-without-subnet-property/4067952).
23
23
24
-
It's best to define your subnets as child resources, as in this example:
24
+
It's best to define your subnets as [child resources](./child-resource-name-type.md#within-parent-resource), as in this example:
You often need to refer to a subnet's resource ID. When you use the `subnets` property to define your subnet, [you can use the `existing` keyword](existing-resource.md) to also obtain a strongly typed reference to the subnet, and then access the subnet's `id` property:
65
-
66
-
> The following example is part of a larger example. For a Bicep file that you can deploy, [see the complete file](https://raw.githubusercontent.com/Azure/azure-docs-bicep-samples/main/samples/scenarios-virtual-networks/vnet.bicep).
Because this example uses the `existing` keyword to access the subnet resource, instead of defining the complete subnet resource, it doesn't have the risks outlined in the previous section.
114
-
115
-
You can also combine the `existing` and `scope` keywords to refer to a virtual network or subnet resource in another resource group.
62
+
To reference a nested resource outside the parent resource, it must be qualified with the containing resource name and the :: operator as shown in the preceding exeample.
116
63
117
64
## Network security groups
118
65
@@ -133,4 +80,3 @@ Private endpoint approval is an operation, so you can't perform it directly with
133
80
- Quickstart templates
134
81
-[Create a Virtual Network with two Subnets](https://azure.microsoft.com/resources/templates/vnet-two-subnets/)
135
82
-[Virtual Network with diagnostic logs](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.network/vnet-create-with-diagnostic-logs)
0 commit comments