{ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "chefAdminUsername": { "type": "string", "minLength": 1, "metadata": { "description": "User name for the Chef Server." }, "defaultValue": "chefadmin" }, "chefAdminPassword": { "type": "securestring", "metadata": { "description": "Password for the Chef Server." } }, "chefDnsNameForPublicIP": { "type": "string", "minLength": 1, "metadata": { "description": "Globally unique DNS Name for the Public IP used to access the Chef Server." } } }, "variables": { "chefImagePublisher": "Canonical", "chefImageOffer": "UbuntuServer", "chefImageSku": "16.04.3-LTS", "chefOSDiskName": "chefOsdisk", "chefNicName": "chefNic", "addressPrefix": "10.0.0.0/16", "subnetName": "Subnet", "subnetPrefix": "10.0.0.0/24", "storageName": "[concat('vhdstorage', uniqueString(resourceGroup().id))]", "storageType": "Standard_LRS", "publicIPAddressType": "Dynamic", "vhdStorageContainerName": "vhds", "chefNsgName": "chefNSG", "chefVmSize": "Standard_A3", "chefVmName": "[toLower(parameters('chefDnsNameForPublicIP'))]", "virtualNetworkName": "chefVNET", "vnetId": "[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]", "subnetRef": "[concat(variables('vnetId'), '/subnets/', variables('subnetName'))]" }, "resources": [ { "type": "Microsoft.Storage/storageAccounts", "name": "[toLower(variables('storageName'))]", "apiVersion": "2015-05-01-preview", "location": "[resourceGroup().location]", "tags": { "displayName": "StorageAccount" }, "properties": { "accountType": "[variables('storageType')]" } }, { "apiVersion": "2015-05-01-preview", "type": "Microsoft.Network/networkSecurityGroups", "name": "[variables('chefNsgName')]", "location": "[resourceGroup().location]", "tags": { "displayName": "NSG-chef" }, "properties": { "securityRules": [ { "name": "SSH", "properties": { "description": "SSH port", "protocol": "Tcp", "sourcePortRange": "*", "destinationPortRange": "22", "sourceAddressPrefix": "*", "destinationAddressPrefix": "*", "access": "Allow", "priority": 1000, "direction": "Inbound" } }, { "name": "HTTP", "properties": { "description": "HTTP port", "protocol": "Tcp", "sourcePortRange": "*", "destinationPortRange": "80", "sourceAddressPrefix": "*", "destinationAddressPrefix": "*", "access": "Allow", "priority": 1100, "direction": "Inbound" } }, { "name": "HTTPS", "properties": { "description": "HTTPS port", "protocol": "Tcp", "sourcePortRange": "*", "destinationPortRange": "443", "sourceAddressPrefix": "*", "destinationAddressPrefix": "*", "access": "Allow", "priority": 1200, "direction": "Inbound" } }, { "name": "https8443", "properties": { "description": "https8443", "protocol": "Tcp", "sourcePortRange": "*", "destinationPortRange": "8443", "sourceAddressPrefix": "*", "destinationAddressPrefix": "*", "access": "Allow", "priority": 1300, "direction": "Inbound" } } ] } }, { "apiVersion": "2015-05-01-preview", "type": "Microsoft.Network/publicIPAddresses", "name": "[parameters('chefDnsNameForPublicIP')]", "location": "[resourceGroup().location]", "tags": { "displayName": "PublicIPAddress-Chef" }, "properties": { "publicIPAllocationMethod": "[variables('publicIPAddressType')]", "dnsSettings": { "domainNameLabel": "[parameters('chefDnsNameForPublicIP')]" } } }, { "apiVersion": "2015-05-01-preview", "type": "Microsoft.Network/virtualNetworks", "name": "[variables('virtualNetworkName')]", "location": "[resourceGroup().location]", "tags": { "displayName": "VirtualNetwork" }, "properties": { "addressSpace": { "addressPrefixes": [ "[variables('addressPrefix')]" ] }, "subnets": [ { "name": "[variables('subnetName')]", "properties": { "addressPrefix": "[variables('subnetPrefix')]" } } ] } }, { "apiVersion": "2015-05-01-preview", "type": "Microsoft.Network/networkInterfaces", "name": "[variables('chefNicName')]", "location": "[resourceGroup().location]", "tags": { "displayName": "NIC-Chef" }, "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('chefDnsNameForPublicIP'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", "[concat('Microsoft.Network/networkSecurityGroups/', variables('chefNSGName'))]" ], "properties": { "networkSecurityGroup": { "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('chefNSGName'))]" }, "ipConfigurations": [ { "name": "ipconfig1", "properties": { "privateIPAllocationMethod": "Dynamic", "publicIPAddress": { "id": "[resourceId('Microsoft.Network/publicIPAddresses', parameters('chefDnsNameForPublicIP'))]" }, "subnet": { "id": "[variables('subnetRef')]" } } } ] } }, { "apiVersion": "2015-06-15", "type": "Microsoft.Compute/virtualMachines", "name": "[variables('chefVmName')]", "location": "[resourceGroup().location]", "tags": { "displayName": "VM-Chef" }, "dependsOn": [ "[concat('Microsoft.Storage/storageAccounts/', variables('storageName'))]", "[concat('Microsoft.Network/networkInterfaces/', variables('chefNicName'))]" ], "properties": { "hardwareProfile": { "vmSize": "[variables('chefVmSize')]" }, "osProfile": { "computerName": "[variables('chefVmName')]", "adminUsername": "[parameters('chefAdminUsername')]", "adminPassword": "[parameters('chefAdminPassword')]" }, "storageProfile": { "imageReference": { "publisher": "[variables('chefImagePublisher')]", "offer": "[variables('chefImageOffer')]", "sku": "[variables('chefImageSku')]", "version": "latest" }, "osDisk": { "name": "osdisk", "vhd": { "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob, variables('vhdStorageContainerName'),'/',variables('chefOSDiskName'),'.vhd')]" }, "caching": "ReadWrite", "createOption": "FromImage" } }, "networkProfile": { "networkInterfaces": [ { "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('chefNicName'))]" } ] }, "diagnosticsProfile": { "bootDiagnostics": { "enabled": "true", "storageUri": "[reference(concat('Microsoft.Storage/storageAccounts/', variables('storageName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob]" } } } }, { "type": "Microsoft.Compute/virtualMachines/extensions", "name": "[concat(variables('chefVmName'),'/CustomScriptForLinux')]", "apiVersion": "2015-06-15", "location": "[resourceGroup().location]", "dependsOn": [ "[concat('Microsoft.Compute/virtualMachines/', variables('chefVmName'))]" ], "properties": { "publisher": "Microsoft.OSTCExtensions", "type": "CustomScriptForLinux", "typeHandlerVersion": "1.3", "autoUpgradeMinorVersion": "true", "settings": { "fileUris": [ "https://raw.githubusercontent.com/Microsoft/PartsUnlimitedMRP/master/deploy/azurestack/customscripts/chef/install_chef.sh" ] }, "protectedSettings": { "commandToExecute": "[concat('bash install_chef.sh ', concat(parameters('chefDnsNameForPublicIP'),'.',resourceGroup().location,'.cloudapp.azurestack.external'), ' ', parameters('chefAdminUsername'), ' ', parameters('chefAdminPassword'))]" } } }, { "type": "Microsoft.Compute/virtualMachines/extensions", "name": "[concat(variables('chefVmName'),'/LinuxVMAccessExtension')]", "apiVersion": "2015-06-15", "location": "[resourceGroup().location]", "dependsOn": [ "[concat('Microsoft.Compute/virtualMachines/', variables('chefVmName'),'/extensions/CustomScriptForLinux')]" ], "properties": { "publisher": "Microsoft.OSTCExtensions", "type": "VMAccessForLinux", "typeHandlerVersion": "1.4", "autoUpgradeMinorVersion": "true", "settings": {}, "protectedSettings": { "username": "[parameters('chefAdminUsername')]", "password": "[parameters('chefAdminPassword')]" } } } ] }