Last active
March 15, 2021 12:47
-
-
Save ajinkya101/9b7439773193a6111e2775cd63390d9f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// All Parameters required for Network Deployment is given here. | |
param location string = resourceGroup().location | |
// All Variables required for Network Deployment is given here. | |
var addressPrefix = '10.10.0.0/16' | |
var subnetName = 'Subnet1' | |
var subnetPrefix = '10.10.1.0/24' | |
var virtualNetworkName = 'VNET1' | |
var networkSecurityGroupName = 'default-NSG' | |
// ------------------------------------------------- | |
// Azure Network Security Group Resource is created. | |
// ------------------------------------------------- | |
resource sg 'Microsoft.Network/networkSecurityGroups@2020-06-01' = { | |
name: networkSecurityGroupName | |
location: location | |
properties: { | |
securityRules: [ | |
{ | |
name: 'default-allow-3389' | |
'properties': { | |
priority: 1000 | |
access: 'Allow' | |
direction: 'Inbound' | |
destinationPortRange: '3389' | |
protocol: 'Tcp' | |
sourcePortRange: '*' | |
sourceAddressPrefix: '*' | |
destinationAddressPrefix: '*' | |
} | |
} | |
] | |
} | |
} | |
// ------------------------------------------ | |
// Azure Virtual Network Resource is created. | |
// ------------------------------------------ | |
resource vn 'Microsoft.Network/virtualNetworks@2020-06-01' = { | |
name: virtualNetworkName | |
location: location | |
properties: { | |
addressSpace: { | |
addressPrefixes: [ | |
addressPrefix | |
] | |
} | |
subnets: [ | |
{ | |
name: subnetName | |
properties: { | |
addressPrefix: subnetPrefix | |
networkSecurityGroup: { | |
id: sg.id | |
} | |
} | |
} | |
] | |
} | |
} | |
// The above vnet is passed as an object, so that it can be used by another module. | |
output results object = { | |
vnet: vn | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment