Created
August 8, 2023 12:12
-
-
Save krnese/95132673566204a74bd4f7b23afdd203 to your computer and use it in GitHub Desktop.
Compliant subnet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"vnetName": { | |
"defaultValue": "knvnet-eastus", | |
"type": "String" | |
}, | |
"nsgName": { | |
"defaultValue": "nsg-eastus", | |
"type": "String" | |
}, | |
"udrName": { | |
"defaultValue": "udr-eastus", | |
"type": "String" | |
}, | |
"resourceslocation": { | |
"defaultValue": "[deployment().location]", | |
"type": "String" | |
}, | |
"resourceGroupName": { | |
"defaultValue": "vnet", | |
"type": "String" | |
}, | |
"subnetPrefix": { | |
"defaultValue": "192.168.5.0/24", | |
"type": "String" | |
}, | |
"subnetName": { | |
"defaultValue": "knsubnet-eastus", | |
"type": "String" | |
} | |
}, | |
"variables": {}, | |
"resources": [ | |
{ | |
"type": "Microsoft.Resources/resourceGroups", | |
"apiVersion": "2022-09-01", | |
"name": "[parameters('resourceGroupName')]", | |
"location": "[parameters('resourceslocation')]", | |
"properties": {} | |
}, | |
{ | |
"type": "Microsoft.Resources/deployments", | |
"apiVersion": "2019-10-01", | |
"name": "[concat(deployment().name, '-vnet', parameters('resourcesLocation'))]", | |
"dependsOn": [ | |
"[concat('Microsoft.Resources/resourceGroups/', parameters('resourceGroupName'))]" | |
], | |
"properties": { | |
"mode": "Incremental", | |
"template": { | |
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": {}, | |
"resources": [ | |
{ | |
"type": "Microsoft.Network/networkSecurityGroups", | |
"apiVersion": "2022-07-01", | |
"name": "[parameters('nsgName')]", | |
"location": "[parameters('resourcesLocation')]", | |
"properties": { | |
"securityRules": [] | |
} | |
}, | |
{ | |
"type": "Microsoft.Network/routeTables", | |
"apiVersion": "2020-11-01", | |
"name": "[parameters('udrName')]", | |
"location": "[parameters('resourcesLocation')]", | |
"properties": { | |
"disableBgpRoutePropagation": false, | |
"routes": [] | |
} | |
}, | |
{ | |
"type": "Microsoft.Network/virtualNetworks/subnets", | |
"apiVersion": "2022-09-01", | |
"name": "[concat(parameters('vnetName'), '/', parameters('subnetName'))]", | |
"dependsOn": [ | |
"[concat('Microsoft.Network/networkSecurityGroups/', parameters('nsgName'))]", | |
"[concat('Microsoft.Network/routeTables/', parameters('udrName'))]" | |
], | |
"properties": { | |
"addressPrefix": "[parameters('subnetPrefix')]", | |
"routeTable": { | |
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Network/routeTables/', parameters('udrName'))]" | |
}, | |
"networkSecurityGroup": { | |
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Network/networkSecurityGroups/', parameters('nsgName'))]" | |
} | |
} | |
} | |
] | |
} | |
}, | |
"resourceGroup": "[parameters('resourceGroupName')]" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment