{ "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "location": { "type": "String" }, "networkInterfaceName": { "type": "String" }, "enableAcceleratedNetworking": { "type": "Bool" }, "networkSecurityGroupName": { "type": "String" }, "networkSecurityGroupRules": { "type": "Array" }, "subnetName": { "type": "String" }, "virtualNetworkId": { "type": "String" }, "publicIpAddressName": { "type": "String" }, "publicIpAddressType": { "type": "String" }, "publicIpAddressSku": { "type": "String" }, "pipDeleteOption": { "type": "String" }, "virtualMachineName": { "type": "String" }, "virtualMachineComputerName": { "type": "String" }, "virtualMachineRG": { "type": "String" }, "osDiskType": { "type": "String" }, "osDiskDeleteOption": { "type": "String" }, "virtualMachineSize": { "type": "String" }, "nicDeleteOption": { "type": "String" }, "adminUsername": { "type": "String" }, "adminPassword": { "type": "SecureString" }, "securityType": { "type": "String" }, "secureBoot": { "type": "Bool" }, "vTPM": { "type": "Bool" } }, "variables": { "nsgId": "[resourceId(resourceGroup().name, 'Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroupName'))]", "vnetId": "[parameters('virtualNetworkId')]", "vnetName": "[last(split(variables('vnetId'), '/'))]", "subnetRef": "[concat(variables('vnetId'), '/subnets/', parameters('subnetName'))]" }, "resources": [ { "type": "Microsoft.Network/networkInterfaces", "apiVersion": "2021-08-01", "name": "[parameters('networkInterfaceName')]", "location": "[parameters('location')]", "dependsOn": [ "[concat('Microsoft.Network/networkSecurityGroups/', parameters('networkSecurityGroupName'))]", "[concat('Microsoft.Network/publicIpAddresses/', parameters('publicIpAddressName'))]" ], "properties": { "ipConfigurations": [ { "name": "ipconfig1", "properties": { "subnet": { "id": "[variables('subnetRef')]" }, "privateIPAllocationMethod": "Dynamic", "publicIpAddress": { "id": "[resourceId(resourceGroup().name, 'Microsoft.Network/publicIpAddresses', parameters('publicIpAddressName'))]", "properties": { "deleteOption": "[parameters('pipDeleteOption')]" } } } } ], "enableAcceleratedNetworking": "[parameters('enableAcceleratedNetworking')]", "networkSecurityGroup": { "id": "[variables('nsgId')]" } } }, { "type": "Microsoft.Network/networkSecurityGroups", "apiVersion": "2019-02-01", "name": "[parameters('networkSecurityGroupName')]", "location": "[parameters('location')]", "properties": { "securityRules": "[parameters('networkSecurityGroupRules')]" } }, { "type": "Microsoft.Network/publicIpAddresses", "apiVersion": "2020-08-01", "name": "[parameters('publicIpAddressName')]", "location": "[parameters('location')]", "sku": { "name": "[parameters('publicIpAddressSku')]" }, "properties": { "publicIpAllocationMethod": "[parameters('publicIpAddressType')]" } }, { "type": "Microsoft.Compute/virtualMachines", "apiVersion": "2022-03-01", "name": "[parameters('virtualMachineName')]", "location": "[parameters('location')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('networkInterfaceName'))]" ], "properties": { "hardwareProfile": { "vmSize": "[parameters('virtualMachineSize')]" }, "storageProfile": { "osDisk": { "createOption": "fromImage", "managedDisk": { "storageAccountType": "[parameters('osDiskType')]" }, "deleteOption": "[parameters('osDiskDeleteOption')]" }, "imageReference": { "publisher": "RedHat", "offer": "RHEL", "sku": "87-gen2", "version": "latest" } }, "networkProfile": { "networkInterfaces": [ { "id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]", "properties": { "deleteOption": "[parameters('nicDeleteOption')]" } } ] }, "osProfile": { "computerName": "[parameters('virtualMachineComputerName')]", "adminUsername": "[parameters('adminUsername')]", "adminPassword": "[parameters('adminPassword')]", "linuxConfiguration": { "patchSettings": { "patchMode": "ImageDefault" } } }, "securityProfile": { "securityType": "[parameters('securityType')]", "uefiSettings": { "secureBootEnabled": "[parameters('secureBoot')]", "vTpmEnabled": "[parameters('vTPM')]" } } } } ], "outputs": { "adminUsername": { "type": "String", "value": "[parameters('adminUsername')]" } } }