Last active
October 9, 2025 15:09
-
-
Save sonalranjit/e23d1db5349eda1dc456d1984b6967e7 to your computer and use it in GitHub Desktop.
Azure linkedTemplate
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/2019-04-01/deploymentTemplate.json#", | |
| "contentVersion": "1.0.0.0", | |
| "parameters": { | |
| "location": { | |
| "type": "string" | |
| }, | |
| "vmName": { | |
| "type": "string" | |
| }, | |
| "publisherName": { | |
| "type": "string" | |
| }, | |
| "offerName": { | |
| "type": "string" | |
| }, | |
| "offerPlanName": { | |
| "type": "string" | |
| }, | |
| "imageVersion": { | |
| "type": "string" | |
| }, | |
| "adminUserName": { | |
| "type": "string", | |
| "defaultValue": "bluecat" | |
| }, | |
| "adminPasswordOrKey": { | |
| "type": "securestring" | |
| }, | |
| "licenseId": { | |
| "defaultValue": "", | |
| "type": "string" | |
| }, | |
| "licenseKey": { | |
| "defaultValue": "", | |
| "type": "string" | |
| }, | |
| "vmSize": { | |
| "type": "string" | |
| }, | |
| "virtualNetwork": { | |
| "type": "object" | |
| }, | |
| "virtualNetworkResourceGroupName": { | |
| "type": "string" | |
| }, | |
| "storageAccountName": { | |
| "type": "string" | |
| }, | |
| "storageAccountType": { | |
| "type": "string" | |
| }, | |
| "storageAccountResourceGroupName": { | |
| "type": "string" | |
| }, | |
| "publicIpNewOrExistingOrNone": { | |
| "type": "string", | |
| "defaultValue": "none", | |
| "metadata": { | |
| "description": "Determines whether or not a new public ip should be provisioned." | |
| } | |
| }, | |
| "publicIpName": { | |
| "type": "string", | |
| "defaultValue": "PublicIp", | |
| "metadata": { | |
| "description": "Name of the public ip address" | |
| } | |
| }, | |
| "publicIpAllocationMethod": { | |
| "type": "string", | |
| "defaultValue": "Dynamic", | |
| "allowedValues": [ | |
| "Dynamic", | |
| "Static", | |
| "" | |
| ] | |
| }, | |
| "publicIpResourceGroupName": { | |
| "type": "string" | |
| }, | |
| "availabilityOption": { | |
| "type": "string", | |
| "defaultValue": "none" | |
| }, | |
| "zone": { | |
| "type": "string", | |
| "defaultValue": "1", | |
| "allowedValues": [ "1", "2", "3" ] | |
| }, | |
| "availabilitySetId": { | |
| "type": "object" | |
| }, | |
| "servicePrivateIps": { | |
| "type": "string" | |
| }, | |
| "managementPrivateIps": { | |
| "type": "string" | |
| }, | |
| "vmCount": { | |
| "type": "int" | |
| } | |
| }, | |
| "variables": { | |
| "publicIpName": "[if(equals(parameters('availabilityOption'), 'availabilityZone'), concat(parameters('publicIpResourceGroupName'), '-', parameters('publicIpName'), '-', parameters('vmCount'), '-az'), concat(parameters('publicIpName'), '-', parameters('vmCount')))]", | |
| "serviceNicName": "[concat(parameters('vmName'), '-service-nic-', parameters('vmCount'))]", | |
| "managementNicName": "[concat(parameters('vmName'), '-management-nic-', parameters('vmCount'))]", | |
| "publicIpId": { | |
| "id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIpName'))]" | |
| } | |
| }, | |
| "resources": [ | |
| { | |
| "condition": "[and(equals(parameters('publicIpNewOrExistingOrNone'), 'new'), equals(parameters('availabilityOption'),'availabilityZone'))]", | |
| "apiVersion": "2022-05-01", | |
| "type": "Microsoft.Network/publicIPAddresses", | |
| "name": "[concat(parameters('publicIpResourceGroupName'), '-', parameters('publicIpName'),'-', parameters('vmCount'), '-az')]", | |
| "location": "[parameters('location')]", | |
| "comments": "Creates a new public IP address object", | |
| "sku": { | |
| "name": "Standard" | |
| }, | |
| "properties": { | |
| "publicIPAllocationMethod": "Static" | |
| } | |
| }, | |
| { | |
| "condition": "[and(equals(parameters('publicIpNewOrExistingOrNone'), 'new'), or(equals(parameters('availabilityOption'),'availabilitySet'), equals(parameters('availabilityOption'), 'none')))]", | |
| "apiVersion": "2022-05-01", | |
| "type": "Microsoft.Network/publicIPAddresses", | |
| "name": "[concat(parameters('publicIpName'), '-', parameters('vmCount'))]", | |
| "location": "[parameters('location')]", | |
| "comments": "Creates a new public IP address object", | |
| "sku": { | |
| "name": "Basic" | |
| }, | |
| "properties": { | |
| "publicIPAllocationMethod": "[parameters('publicIpAllocationMethod')]" | |
| } | |
| }, | |
| { | |
| "apiVersion": "2022-05-01", | |
| "type": "Microsoft.Network/networkInterfaces", | |
| "name": "[concat(parameters('vmName'), '-service-nic-', parameters('vmCount'))]", | |
| "location": "[parameters('location')]", | |
| "comments": "The NIC for service (eth0)", | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIpName'))]" | |
| ], | |
| "properties": { | |
| "ipConfigurations": [ | |
| { | |
| "name": "service-nic", | |
| "properties": { | |
| "subnet": { | |
| "id": "[resourceId(parameters('virtualNetworkResourceGroupName'), 'Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetwork').name, parameters('virtualNetwork').subnets.subnet1.name)]" | |
| }, | |
| "privateIPAllocationMethod": "Dynamic", | |
| "privateIPAddressVersion": "IPv4", | |
| "publicIPAddress": "[if(not(equals(parameters('publicIpNewOrExistingOrNone'), 'none')), variables('publicIpId'), json('null'))]" | |
| } | |
| } | |
| ] | |
| } | |
| }, | |
| { | |
| "apiVersion": "2022-05-01", | |
| "type": "Microsoft.Network/networkInterfaces", | |
| "name": "[concat(parameters('vmName'), '-management-nic-', parameters('vmCount'))]", | |
| "location": "[parameters('location')]", | |
| "comments": "The NIC for management (eth2)", | |
| "properties": { | |
| "ipConfigurations": [ | |
| { | |
| "name": "management-nic", | |
| "properties": { | |
| "subnet": { | |
| "id": "[resourceId(parameters('virtualNetworkResourceGroupName'), 'Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetwork').name, parameters('virtualNetwork').subnets.subnet2.name)]" | |
| }, | |
| "privateIPAllocationMethod": "Dynamic", | |
| "privateIPAddressVersion": "IPv4" | |
| } | |
| } | |
| ] | |
| } | |
| }, | |
| { | |
| "condition": "[equals(parameters('availabilityOption'), 'availabilitySet')]", | |
| "apiVersion": "2022-08-01", | |
| "type": "Microsoft.Compute/virtualMachines", | |
| "name": "[concat(parameters('vmName'), '-', parameters('vmCount'), '-as')]", | |
| "location": "[parameters('location')]", | |
| "comments": "The virtual machine deployment request for disks", | |
| "dependsOn": [ | |
| "[variables('serviceNicName')]", | |
| "[variables('managementNicName')]" | |
| ], | |
| "plan": { | |
| "publisher": "[parameters('publisherName')]", | |
| "product": "[parameters('offerName')]", | |
| "name": "[parameters('offerPlanName')]" | |
| }, | |
| "properties": { | |
| "availabilitySet": "[parameters('availabilitySetId')]", | |
| "hardwareProfile": { | |
| "vmSize": "[parameters('vmSize')]" | |
| }, | |
| "storageProfile": { | |
| "imageReference": { | |
| "publisher": "[parameters('publisherName')]", | |
| "offer": "[parameters('offerName')]", | |
| "sku": "[parameters('offerPlanName')]", | |
| "version": "[parameters('imageVersion')]" | |
| }, | |
| "osDisk": { | |
| "createOption": "fromImage", | |
| "managedDisk": { | |
| "storageAccountType": "[parameters('storageAccountType')]" | |
| }, | |
| "name": "[concat(parameters('vmName'), '-', parameters('vmCount'))]" | |
| } | |
| }, | |
| "osProfile": { | |
| "adminUsername": "[parameters('adminUserName')]", | |
| "computerName": "[parameters('vmName')]", | |
| "customData": "[base64(concat('#cloud-config\nusers:\n - name: bluecat\n groups: sudo\n lock_passwd: false\n shell: /bin/bash\n sudo: [\"ALL=(ALL) NOPASSWD:ALL\"]\n ssh-authorized-keys:\n - ', parameters('adminPasswordOrKey'), '\n - name: admin\n lock_passwd: false\n ssh-authorized-keys:\n - ', parameters('adminPasswordOrKey'), '\nbluecat_license:\n key: ', parameters('licenseKey'), '\n id: ', parameters('licenseId')))]", | |
| "linuxConfiguration": { | |
| "disablePasswordAuthentication": true, | |
| "ssh": { | |
| "publicKeys": [ | |
| { | |
| "path": "[concat('/home/bluecat/.ssh/authorized_keys')]", | |
| "keyData": "[parameters('adminPasswordOrKey')]" | |
| } | |
| ] | |
| } | |
| } | |
| }, | |
| "networkProfile": { | |
| "networkInterfaces": [ | |
| { | |
| "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('serviceNicName'))]", | |
| "properties": { | |
| "primary": true | |
| } | |
| }, | |
| { | |
| "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('managementNicName'))]", | |
| "properties": { | |
| "primary": false | |
| } | |
| } | |
| ] | |
| }, | |
| "diagnosticsProfile": { | |
| "bootDiagnostics": { | |
| "enabled": true | |
| } | |
| } | |
| } | |
| }, | |
| { | |
| "condition": "[equals(parameters('availabilityOption'), 'availabilityZone')]", | |
| "apiVersion": "2022-08-01", | |
| "type": "Microsoft.Compute/virtualMachines", | |
| "name": "[concat(parameters('vmName'), '-', parameters('vmCount'), '-az')]", | |
| "location": "[parameters('location')]", | |
| "comments": "The virtual machine deployment request for disks", | |
| "zones": [ | |
| "[parameters('zone')]" | |
| ], | |
| "dependsOn": [ | |
| "[variables('serviceNicName')]", | |
| "[variables('managementNicName')]" | |
| ], | |
| "plan": { | |
| "publisher": "[parameters('publisherName')]", | |
| "product": "[parameters('offerName')]", | |
| "name": "[parameters('offerPlanName')]" | |
| }, | |
| "properties": { | |
| "hardwareProfile": { | |
| "vmSize": "[parameters('vmSize')]" | |
| }, | |
| "storageProfile": { | |
| "imageReference": { | |
| "publisher": "[parameters('publisherName')]", | |
| "offer": "[parameters('offerName')]", | |
| "sku": "[parameters('offerPlanName')]", | |
| "version": "[parameters('imageVersion')]" | |
| }, | |
| "osDisk": { | |
| "createOption": "fromImage", | |
| "managedDisk": { | |
| "storageAccountType": "[parameters('storageAccountType')]" | |
| }, | |
| "name": "[concat(parameters('vmName'), '-', parameters('vmCount'))]" | |
| } | |
| }, | |
| "osProfile": { | |
| "adminUsername": "[parameters('adminUserName')]", | |
| "computerName": "[parameters('vmName')]", | |
| "customData": "[base64(concat('#cloud-config\nusers:\n - name: bluecat\n groups: sudo\n lock_passwd: false\n shell: /bin/bash\n sudo: [\"ALL=(ALL) NOPASSWD:ALL\"]\n ssh-authorized-keys:\n - ', parameters('adminPasswordOrKey'), '\n - name: admin\n lock_passwd: false\n ssh-authorized-keys:\n - ', parameters('adminPasswordOrKey'), '\nbluecat_license:\n key: ', parameters('licenseKey'), '\n id: ', parameters('licenseId')))]", | |
| "linuxConfiguration": { | |
| "disablePasswordAuthentication": true, | |
| "ssh": { | |
| "publicKeys": [ | |
| { | |
| "path": "[concat('/home/bluecat/.ssh/authorized_keys')]", | |
| "keyData": "[parameters('adminPasswordOrKey')]" | |
| } | |
| ] | |
| } | |
| } | |
| }, | |
| "networkProfile": { | |
| "networkInterfaces": [ | |
| { | |
| "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('serviceNicName'))]", | |
| "properties": { | |
| "primary": true | |
| } | |
| }, | |
| { | |
| "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('managementNicName'))]", | |
| "properties": { | |
| "primary": false | |
| } | |
| } | |
| ] | |
| }, | |
| "diagnosticsProfile": { | |
| "bootDiagnostics": { | |
| "enabled": true | |
| } | |
| } | |
| } | |
| }, | |
| { | |
| "condition": "[equals(parameters('availabilityOption'), 'none')]", | |
| "apiVersion": "2022-08-01", | |
| "type": "Microsoft.Compute/virtualMachines", | |
| "name": "[concat(parameters('vmName'), '-', parameters('vmCount'))]", | |
| "location": "[parameters('location')]", | |
| "comments": "The virtual machine deployment request for Managed disks", | |
| "dependsOn": [ | |
| "[variables('serviceNicName')]", | |
| "[variables('managementNicName')]" | |
| ], | |
| "plan": { | |
| "publisher": "[parameters('publisherName')]", | |
| "product": "[parameters('offerName')]", | |
| "name": "[parameters('offerPlanName')]" | |
| }, | |
| "properties": { | |
| "hardwareProfile": { | |
| "vmSize": "[parameters('vmSize')]" | |
| }, | |
| "storageProfile": { | |
| "imageReference": { | |
| "publisher": "[parameters('publisherName')]", | |
| "offer": "[parameters('offerName')]", | |
| "sku": "[parameters('offerPlanName')]", | |
| "version": "[parameters('imageVersion')]" | |
| }, | |
| "osDisk": { | |
| "createOption": "fromImage", | |
| "managedDisk": { | |
| "storageAccountType": "[parameters('storageAccountType')]" | |
| }, | |
| "name": "[concat(parameters('vmName'), '-', parameters('vmCount'))]" | |
| } | |
| }, | |
| "osProfile": { | |
| "adminUsername": "[parameters('adminUserName')]", | |
| "computerName": "[parameters('vmName')]", | |
| "customData": "[base64(concat('#cloud-config\nusers:\n - name: bluecat\n groups: sudo\n lock_passwd: false\n shell: /bin/bash\n sudo: [\"ALL=(ALL) NOPASSWD:ALL\"]\n ssh-authorized-keys:\n - ', parameters('adminPasswordOrKey'), '\n - name: admin\n lock_passwd: false\n ssh-authorized-keys:\n - ', parameters('adminPasswordOrKey'), '\nbluecat_license:\n key: ', parameters('licenseKey'), '\n id: ', parameters('licenseId')))]", | |
| "linuxConfiguration": { | |
| "disablePasswordAuthentication": true, | |
| "ssh": { | |
| "publicKeys": [ | |
| { | |
| "path": "[concat('/home/bluecat/.ssh/authorized_keys')]", | |
| "keyData": "[parameters('adminPasswordOrKey')]" | |
| } | |
| ] | |
| } | |
| } | |
| }, | |
| "networkProfile": { | |
| "networkInterfaces": [ | |
| { | |
| "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('serviceNicName'))]", | |
| "properties": { | |
| "primary": true | |
| } | |
| }, | |
| { | |
| "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('managementNicName'))]", | |
| "properties": { | |
| "primary": false | |
| } | |
| } | |
| ] | |
| }, | |
| "diagnosticsProfile": { | |
| "bootDiagnostics": { | |
| "enabled": true | |
| } | |
| } | |
| } | |
| } | |
| ], | |
| "outputs": { | |
| "location": { | |
| "type": "string", | |
| "value": "[parameters('location')]" | |
| }, | |
| "servicePrivateIp": { | |
| "type": "string", | |
| "value": "[if(equals(parameters('servicePrivateIps'), ''), reference(resourceId('Microsoft.Network/networkInterfaces', concat(parameters('vmName'), '-service-nic-', parameters('vmCount')))).ipConfigurations[0].properties.privateIPAddress, concat(parameters('servicePrivateIps'), '; ', reference(resourceId('Microsoft.Network/networkInterfaces', concat(parameters('vmName'), '-service-nic-', parameters('vmCount')))).ipConfigurations[0].properties.privateIPAddress))]" | |
| }, | |
| "managementPrivateIp": { | |
| "type": "string", | |
| "value": "[if(equals(parameters('managementPrivateIps'), ''), reference(resourceId('Microsoft.Network/networkInterfaces', concat(parameters('vmName'), '-management-nic-', parameters('vmCount')))).ipConfigurations[0].properties.privateIPAddress, concat(parameters('managementPrivateIps'), '; ', reference(resourceId('Microsoft.Network/networkInterfaces', concat(parameters('vmName'), '-management-nic-', parameters('vmCount')))).ipConfigurations[0].properties.privateIPAddress))]" | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment