0

Trying to put together an Azure ARM template right now.

However, it seems I can create links between resources in very different ways.

Here for example: https://learn.microsoft.com/en-us/azure/templates/microsoft.network/2019-04-01/virtualnetworks

I can now specify subnets for the virtual network either under .resources or .properties.subnets.

Another way is to create another resource Microsoft.Network/virtualNetworks/subnets on its own and then add a .dependsOn key to reference the virtual network resource id.

Which is the way to go by?

Moritz Schmitz v. Hülst
  • 3,229
  • 4
  • 36
  • 63

1 Answers1

1

@Mortiz When you use https://learn.microsoft.com/en-us/azure/templates/microsoft.network/2019-04-01/virtualnetworks, you are creating a new virtual network and associating subnets under that virtual network.

On the other hand when you use Microsoft.Network/virtualNetworks/subnets, you are just creating subnets under already existing virtual network which is usually added as a .dependsOn

AmanGarg-MSFT
  • 1,123
  • 6
  • 10
  • Thanks. These two differences make sense. However, what about `.resources` and `.properties.subnets`? – Moritz Schmitz v. Hülst Sep 05 '19 at 14:04
  • You create a subnet under `.resouces` using `Microsoft.Network/virtualNetworks/subnets`. To associate a virtual network with created subnets, you would have to use `.properties.subnets` under `Microsoft.Network/virtualNetworks` – AmanGarg-MSFT Sep 05 '19 at 14:11