ARM Templates Contd
Activity
- Reference Architecture:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2021-08-01",
"name": "primaryvnet",
"location": "southindia",
"properties": {
"addressSpace": {
"addressPrefixes": [ "10.100.0.0/16" ]
},
"subnets": [
{
"name": "web",
"properties": {
"addressPrefix": "10.100.0.0/24"
}
},
{
"name": "mgmt",
"properties": {
"addressPrefix": "10.100.1.0/24"
}
},
{
"name": "app",
"properties": {
"addressPrefix": "10.100.2.0/24"
}
},
{
"name": "db",
"properties": {
"addressPrefix": "10.100.3.0/24"
}
}
]
}
},
{
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2021-08-01",
"name": "secondaryvnet",
"location": "centralindia",
"properties": {
"addressSpace": {
"addressPrefixes": [ "10.101.0.0/16" ]
},
"subnets": [
{
"name": "web",
"properties": {
"addressPrefix": "10.101.0.0/24"
}
},
{
"name": "mgmt",
"properties": {
"addressPrefix": "10.101.1.0/24"
}
},
{
"name": "app",
"properties": {
"addressPrefix": "10.101.2.0/24"
}
},
{
"name": "db",
"properties": {
"addressPrefix": "10.101.3.0/24"
}
}
]
}
}
]
}
- Lets try to use paramters to provide user inputs Refer Here and use them using functions Refer Here
- Include the parameters
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"primaryregion": {
"type": "string",
"metadata": {
"description": "This is the primary region"
},
"defaultValue": "southindia"
},
"secondaryregion": {
"type": "string",
"metadata": {
"description": "This is the primary region"
},
"defaultValue": "centralindia"
}
},
"resources": [
{
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2021-08-01",
"name": "primaryvnet",
"location": "[parameters('primaryregion')]",
"properties": {
"addressSpace": {
"addressPrefixes": [ "10.100.0.0/16" ]
},
"subnets": [
{
"name": "web",
"properties": {
"addressPrefix": "10.100.0.0/24"
}
},
{
"name": "mgmt",
"properties": {
"addressPrefix": "10.100.1.0/24"
}
},
{
"name": "app",
"properties": {
"addressPrefix": "10.100.2.0/24"
}
},
{
"name": "db",
"properties": {
"addressPrefix": "10.100.3.0/24"
}
}
]
}
},
{
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2021-08-01",
"name": "secondaryvnet",
"location": "[parameters('secondaryregion')]",
"properties": {
"addressSpace": {
"addressPrefixes": [ "10.101.0.0/16" ]
},
"subnets": [
{
"name": "web",
"properties": {
"addressPrefix": "10.101.0.0/24"
}
},
{
"name": "mgmt",
"properties": {
"addressPrefix": "10.101.1.0/24"
}
},
{
"name": "app",
"properties": {
"addressPrefix": "10.101.2.0/24"
}
},
{
"name": "db",
"properties": {
"addressPrefix": "10.101.3.0/24"
}
}
]
}
}
]
}
* Try to create parameters for address space of primary and secondary vnets and subnets