IaC - 101 - VNET
Virtual Network
The Azure Virtual Network service enables you to securely connect Azure resources to each other with virtual networks (VNets). A VNet is a representation of your own network in the cloud. A VNet is a logical isolation of the Azure cloud dedicated to your subscription. You can also connect VNets to your on-premises network.
Subnet
Understand the CIDR notation CIDR (Classless Inter-Domain Routing, sometimes called supernetting) is a way to allow more flexible allocation of Internet Protocol (IP) addresses than was possible with the original system of IP address classes. As a result, the number of available Internet addresses was greatly increased, which along with widespread use of network address translation (NAT), has significantly extended the useful life of IPv4.
http://whatismyipaddress.com/cidr
PowerShell
ARM Template
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"type": "string"
},
"location": {
"type": "string"
},
"addressPrefix": {
"type": "string",
"defaultValue": "10.0.0.0/16"
},
"subnetName": {
"type": "string",
"defaultValue": "subnet-1"
},
"subnetAddressPrefix": {
"type": "string",
"defaultValue": "10.0.0.0/24"
}
},
"resources": [
{
"apiVersion": "2016-06-01",
"type": "Microsoft.Network/virtualNetworks",
"name": "[parameters('name')]",
"location": "[parameters('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[parameters('addressPrefix')]"
]
},
"subnets": [
{
"name": "[parameters('subnetName')]",
"properties": {
"addressPrefix": "[parameters'subnetAddressPrefix')]"
}
}
]
}
}
]
}
Reusable template
See complete code - vnet resource FAQ See Azure documentation
Please do let me know your thoughts/ suggestions/ question in disqus section.
Related Posts
- Azure VNET provisioning using CLI
- Learn Terraform - 1
- Deploy SonarQube as Azure Web App Container
- Include Pester Test as part of VSTS Build
- IaC Unit Test using Pester Test