Last active
November 6, 2019 20:04
-
-
Save unixfox/149ed52e3c29e5c4be44cb55dd47d538 to your computer and use it in GitHub Desktop.
azure ipv6 linux
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
{ | |
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"adminUsername": { | |
"type": "string", | |
"metadata": { | |
"description": "The name of the administrator of the new VM. Exclusion list: 'admin','administrator'" | |
} | |
}, | |
"adminPassword": { | |
"type": "securestring", | |
"metadata": { | |
"description": "The password for the administrator account of the new VM" | |
} | |
}, | |
"location": { | |
"type": "string", | |
"defaultValue": "[resourceGroup().location]", | |
"metadata": { | |
"description": "Location for all resources." | |
} | |
} | |
}, | |
"variables": { | |
"vnetv4AddressRange": "10.0.0.0/16", | |
"vnetv6AddressRange": "ace:cab:deca::/48", | |
"subnetv4AddressRange": "10.0.0.0/24", | |
"subnetv6AddressRange": "ace:cab:deca:deed::/64", | |
"subnetName": "DualStackSubnet", | |
"newStorageAccountName": "[concat('st', uniqueString(resourceGroup().id))]", | |
"subnet-id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', 'LINUXVNET', variables('subnetName'))]", | |
"numberOfInstances": 1, | |
"vmName": "LinuxVM", | |
"publicipName": "SSHpublicIp", | |
"imagePublisher": "Debian", | |
"imageOffer": "debian-10", | |
"imageSku": "10" | |
}, | |
"resources": [ | |
{ | |
"apiVersion": "2019-02-01", | |
"type": "Microsoft.Network/publicIPAddresses", | |
"name": "[concat(variables('publicipName'), copyindex())]", | |
"copy": { | |
"name": "publicIpLoop", | |
"count": "[variables('numberOfInstances')]" | |
}, | |
"location": "[parameters('location')]", | |
"properties": { | |
"publicIPAllocationMethod": "Dynamic" | |
} | |
}, | |
{ | |
"apiVersion": "2019-02-01", | |
"type": "Microsoft.Network/publicIPAddresses", | |
"name": "linuxlbpublicip", | |
"location": "[parameters('location')]", | |
"properties": { | |
"publicIPAllocationMethod": "Dynamic" | |
} | |
}, | |
{ | |
"apiVersion": "2019-02-01", | |
"type": "Microsoft.Network/publicIPAddresses", | |
"name": "linuxlbpublicip-v6", | |
"location": "[parameters('location')]", | |
"properties": { | |
"publicIPAllocationMethod": "Dynamic", | |
"publicIPAddressVersion": "IPv6" | |
} | |
}, | |
{ | |
"apiVersion": "2019-04-01", | |
"type": "Microsoft.Storage/storageAccounts", | |
"name": "[variables('newStorageAccountName')]", | |
"location": "[parameters('location')]", | |
"sku": { | |
"name": "Standard_LRS" | |
}, | |
"kind": "StorageV2", | |
"properties": { } | |
}, | |
{ | |
"apiVersion": "2019-02-01", | |
"name": "linuxloadBalancer", | |
"type": "Microsoft.Network/loadBalancers", | |
"location": "[parameters('location')]", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Network/publicIPAddresses','linuxlbpublicip')]", | |
"[resourceId('Microsoft.Network/publicIPAddresses','linuxlbpublicip-v6')]" | |
], | |
"properties": { | |
"frontendIpConfigurations": [ | |
{ | |
"name": "LBFE", | |
"properties": { | |
"publicIPAddress": { | |
"id": "[resourceId('Microsoft.Network/publicIPAddresses', 'linuxlbpublicip')]" | |
} | |
} | |
}, | |
{ | |
"name": "LBFE-v6", | |
"properties": { | |
"publicIPAddress": { | |
"id": "[resourceId('Microsoft.Network/publicIPAddresses','linuxlbpublicip-v6')]" | |
} | |
} | |
} | |
], | |
"backendAddressPools": [ | |
{ | |
"name": "LBBAP" | |
}, | |
{ | |
"name": "LBBAP-v6" | |
} | |
], | |
"loadBalancingRules": [ | |
{ | |
"properties": { | |
"frontendIPConfiguration": { | |
"id": "[resourceId('Microsoft.Network/loadBalancers/frontendIpConfigurations', 'linuxloadBalancer', 'LBFE')]" | |
}, | |
"backendAddressPool": { | |
"id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', 'linuxloadBalancer', 'LBBAP')]" | |
}, | |
"protocol": "Tcp", | |
"frontendPort": 80, | |
"backendPort": 80, | |
"idleTimeoutInMinutes": 15 | |
}, | |
"name": "lbrule" | |
}, | |
{ | |
"properties": { | |
"frontendIPConfiguration": { | |
"id": "[resourceId('Microsoft.Network/loadBalancers/frontendIpConfigurations', 'linuxloadBalancer', 'LBFE-v6')]" | |
}, | |
"backendAddressPool": { | |
"id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', 'linuxloadBalancer', 'LBBAP-v6')]" | |
}, | |
"protocol": "Tcp", | |
"frontendPort": 80, | |
"backendPort": 80 | |
}, | |
"name": "lbrule-v6" | |
} | |
] | |
} | |
}, | |
{ | |
"apiVersion": "2019-02-01", | |
"type": "Microsoft.Network/virtualNetworks", | |
"name": "LINUXVNET", | |
"location": "[parameters('location')]", | |
"properties": { | |
"addressSpace": { | |
"addressPrefixes": [ | |
"[variables('vnetv4AddressRange')]", | |
"[variables('vnetv6AddressRange')]" | |
] | |
}, | |
"subnets": [ | |
{ | |
"name": "[variables('subnetName')]", | |
"properties": { | |
"addressPrefixes": [ | |
"[variables('subnetv4AddressRange')]", | |
"[variables('subnetv6AddressRange')]" | |
] | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"apiVersion": "2019-02-01", | |
"type": "Microsoft.Network/networkSecurityGroups", | |
"name": "LinuxdsNsg", | |
"location": "[parameters('location')]", | |
"properties": { | |
"securityRules": [ | |
{ | |
"name": "allow-HTTP-in", | |
"properties": { | |
"description": "Allow HTTP", | |
"protocol": "TCP", | |
"sourcePortRange": "80", | |
"destinationPortRange": "80", | |
"sourceAddressPrefix": "*", | |
"destinationAddressPrefix": "*", | |
"access": "Allow", | |
"priority": 1001, | |
"direction": "Inbound" | |
} | |
}, | |
{ | |
"name": "allow-all-out", | |
"properties": { | |
"description": "Allow out All", | |
"protocol": "*", | |
"sourcePortRange": "*", | |
"destinationPortRange": "*", | |
"sourceAddressPrefix": "*", | |
"destinationAddressPrefix": "*", | |
"access": "Allow", | |
"priority": 1002, | |
"direction": "Outbound" | |
} | |
}, | |
{ | |
"name": "allow-RDP-in", | |
"properties": { | |
"description": "Allow RDP", | |
"protocol": "Tcp", | |
"sourcePortRange": "*", | |
"destinationPortRange": "3389", | |
"sourceAddressPrefix": "*", | |
"destinationAddressPrefix": "*", | |
"access": "Allow", | |
"priority": 1003, | |
"direction": "Inbound" | |
} | |
}, | |
{ | |
"name": "allow-MyIpv6App-out", | |
"properties": { | |
"description": "Allow My IPv6 App", | |
"protocol": "Tcp", | |
"sourcePortRange": "33819-33829", | |
"destinationPortRange": "5000-6000", | |
"sourceAddressPrefix": "ace:cab:deca:deed::/64", | |
"destinationAddressPrefixes": [ "cab:cab:aaaa:bbbb::/64", "cab:cab:1111:2222::/64" ], | |
"access": "Allow", | |
"priority": 1004, | |
"direction": "Outbound" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "Microsoft.Network/routeTables", | |
"name": "linuxv6routeTable", | |
"apiVersion": "2019-02-01", | |
"location": "[parameters('location')]", | |
"properties": { | |
"routes": [ | |
{ | |
"name": "v6route", | |
"properties": { | |
"addressPrefix": "cab:cab::/96", | |
"nextHopType": "VirtualAppliance", | |
"nextHopIpAddress": "ace:cab:deca:f00d::1" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"apiVersion": "2019-02-01", | |
"type": "Microsoft.Network/networkInterfaces", | |
"name": "[concat(variables('vmName'),copyindex())]", | |
"copy": { | |
"name": "netIntLoop", | |
"count": "[variables('numberOfInstances')]" | |
}, | |
"location": "[parameters('location')]", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Network/virtualNetworks','LINUXVNET')]", | |
"[resourceId('Microsoft.Network/networkSecurityGroups','LinuxdsNsg')]", | |
"[resourceId('Microsoft.Network/loadBalancers','linuxloadBalancer')]", | |
"publicIpLoop" | |
], | |
"properties": { | |
"networkSecurityGroup": { | |
"id": "[resourceId('Microsoft.Network/networkSecurityGroups','LinuxdsNsg')]" | |
}, | |
"ipConfigurations": [ | |
{ | |
"name": "ipconfig-v4", | |
"properties": { | |
"privateIPAllocationMethod": "Dynamic", | |
"privateIPAddressVersion": "IPv4", | |
"primary": "true", | |
"publicIPAddress": { | |
"id": "[resourceId('Microsoft.Network/publicIPAddresses',concat(variables('publicipName'),copyindex()))]" | |
}, | |
"subnet": { | |
"id": "[variables('subnet-id')]" | |
}, | |
"loadBalancerBackendAddressPools": [ | |
{ | |
"id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', 'linuxloadBalancer', 'LBBAP')]" | |
} | |
] | |
} | |
}, | |
{ | |
"name": "ipconfig-v6", | |
"properties": { | |
"privateIPAllocationMethod": "Dynamic", | |
"privateIPAddressVersion": "IPv6", | |
"subnet": { | |
"id": "[variables('subnet-id')]" | |
}, | |
"loadBalancerBackendAddressPools": [ | |
{ | |
"id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', 'linuxloadBalancer', 'LBBAP-v6')]" | |
} | |
] | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"apiVersion": "2019-03-01", | |
"type": "Microsoft.Compute/virtualMachines", | |
"name": "[concat(variables('vmName'), copyindex())]", | |
"copy": { | |
"name": "virtualMachineLoop", | |
"count": "[variables('numberOfInstances')]" | |
}, | |
"location": "[parameters('location')]", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Storage/storageAccounts',variables('newStorageAccountName'))]", | |
"netIntLoop" | |
], | |
"properties": { | |
"hardwareProfile": { | |
"vmSize": "Standard_B1s" | |
}, | |
"osProfile": { | |
"computerName": "[concat(variables('vmName'), copyindex())]", | |
"adminUsername": "[parameters('adminUserName')]", | |
"adminPassword": "[parameters('adminPassword')]" | |
}, | |
"storageProfile": { | |
"imageReference": { | |
"publisher": "[variables('imagePublisher')]", | |
"offer": "[variables('imageOffer')]", | |
"sku": "[variables('imageSku')]", | |
"version": "latest" | |
}, | |
"osDisk": { | |
"createOption": "FromImage" | |
} | |
}, | |
"networkProfile": { | |
"networkInterfaces": [ | |
{ | |
"id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('vmName'),copyindex()))]" | |
} | |
] | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment