Working template

This commit is contained in:
Jeffrey Cline 2018-02-02 18:57:19 -08:00
parent 0ba5c18031
commit f3425a7e04
2 changed files with 526 additions and 577 deletions

View File

@ -1,253 +1,174 @@
{ {
"$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#",
"handler": "Microsoft.Compute.MultiVm", "handler": "Microsoft.Compute.MultiVm",
"version": "0.1.2-preview", "version": "0.1.2-preview",
"parameters": { "parameters": {
"basics": [ "basics": [
{ {
"name": "vmName", "name": "vmName",
"type": "Microsoft.Common.TextBox", "type": "Microsoft.Common.TextBox",
"label": "Name", "label": "Name",
"defaultValue": "terraform", "defaultValue": "Terraform",
"toolTip": "", "toolTip": "",
"constraints": { "constraints": {
"required": true, "required": true,
"regex": "^[a-z0-9A-Z]{1,54}$", "regex": "^[a-z0-9A-Z]{1,54}$",
"validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-54 characters long." "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-54 characters long."
}, },
"visible": true "visible": true
}, },
{ {
"name": "userName", "name": "userName",
"type": "Microsoft.Compute.UserNameTextBox", "type": "Microsoft.Compute.UserNameTextBox",
"label": "User name", "label": "User name",
"defaultValue": "", "defaultValue": "",
"toolTip": "", "toolTip": "",
"constraints": { "constraints": {
"required": true "required": true
}, },
"osPlatform": "Linux", "osPlatform": "Linux",
"visible": true "visible": true
}, },
{ {
"name": "authType", "name": "authType",
"type": "Microsoft.Compute.CredentialsCombo", "type": "Microsoft.Compute.CredentialsCombo",
"label": { "label": {
"authenticationType": "Authentication type", "authenticationType": "Authentication type",
"password": "Password", "password": "Password",
"confirmPassword": "Confirm password", "confirmPassword": "Confirm password",
"sshPublicKey": "SSH public key" "sshPublicKey": "SSH public key"
}, },
"toolTip": { "toolTip": {
"authenticationType": "", "authenticationType": "",
"password": "", "password": "",
"sshPublicKey": "" "sshPublicKey": ""
}, },
"constraints": { "constraints": {
"required": true, "required": true,
"customPasswordRegex": "^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d@#\\$%\\^&\\*-_!+=\\[\\]\\{\\}\\|\\\\:',\\.\\?\\/`~\"\\(\\);]{8,}$", "customPasswordRegex": "^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d@#\\$%\\^&\\*-_!+=\\[\\]\\{\\}\\|\\\\:',\\.\\?\\/`~\"\\(\\);]{8,}$",
"customValidationMessage": "The password must contain at least 8 characters, with at least 1 letter and 1 number. Alphanumerical (@#$%^&*-_!+=[]{}|\\:',.?/`~\"();)and special characters are allowed" "customValidationMessage": "The password must contain at least 8 characters, with at least 1 letter and 1 number. Alphanumerical (@#$%^&*-_!+=[]{}|\\:',.?/`~\"();)and special characters are allowed"
}, },
"options": { "options": {
"hideConfirmation": false, "hideConfirmation": false,
"hidePassword": false "hidePassword": false
}, },
"osPlatform": "Linux", "osPlatform": "Linux",
"visible": true "visible": true
} }
], ],
"steps": [ "steps": [
{ {
"name": "firstStep", "name": "firstStep",
"label": "Additional Settings", "label": "Virtual Machine Settings",
"bladeTitle": "Additional Settings", "bladeTitle": "Virtual Machine Settings",
"subLabel": { "subLabel": {
"preValidation": "", "preValidation": "",
"postValidation": "Done" "postValidation": "Done"
}, },
"elements": [ "elements": [
{ {
"name": "vmSize", "name": "vmSize",
"type": "Microsoft.Compute.SizeSelector", "type": "Microsoft.Compute.SizeSelector",
"label": "Size", "label": "Size",
"toolTip": "", "toolTip": "",
"recommendedSizes": [ "recommendedSizes": [
"Standard_DS2_v2", "Standard_DS2_v2",
"Standard_DS1_v2", "Standard_DS1_v2",
"Standard_DS11_v2" "Standard_DS11_v2"
], ],
"osPlatform": "Linux", "osPlatform": "Linux",
"count": 1, "count": 1,
"visible": true "visible": true
}, },
{ {
"name": "vmDiskType", "name": "vmDiskType",
"type": "Microsoft.Common.OptionsGroup", "type": "Microsoft.Common.OptionsGroup",
"label": "VM disk type", "label": "VM disk type",
"defaultValue": "SSD", "defaultValue": "SSD",
"toolTip": "Premium disks (SSD) are backed by solid state drives and offer consistent, low-latency performance. They provide the best balance between price and performance, and are ideal for I/O-intensive applications and production workloads. Standard disks (HDD) are backed by magnetic drives and are preferable for applications where data is accessed infrequently.", "toolTip": "Premium disks (SSD) are backed by solid state drives and offer consistent, low-latency performance. They provide the best balance between price and performance, and are ideal for I/O-intensive applications and production workloads. Standard disks (HDD) are backed by magnetic drives and are preferable for applications where data is accessed infrequently.",
"constraints": { "constraints": {
"allowedValues": [ "allowedValues": [
{ {
"label": "SSD", "label": "SSD",
"value": "Premium_LRS" "value": "Premium_LRS"
}, },
{ {
"label": "HDD", "label": "HDD",
"value": "Standard_LRS" "value": "Standard_LRS"
} }
] ]
}, },
"visible": true "visible": true
}, },
{ {
"name": "vnet", "name": "sptype",
"type": "Microsoft.Network.VirtualNetworkCombo", "type": "Microsoft.Common.DropDown",
"label": { "label": "Service Principal Integration",
"virtualNetwork": "Virtual network", "defaultValue": "Auto(MSI)",
"subnets": "Subnets" "toolTip": "The service pricipal will be added into Terraform as a credential for authenticating with Azure. 'Auto' means that the principal will be created by MSI (Managed Service Identity). 'Manual' means the principal should be created by user and be filled in below.",
}, "constraints": {
"toolTip": { "allowedValues": [
"virtualNetwork": "", {
"subnets": "" "label": "Auto(MSI)",
}, "value": "msi"
"defaultValue": { },
"name": "terraform-vnet", {
"addressPrefixSize": "/16" "label": "Manual",
}, "value": "manual"
"constraints": { }
"minAddressPrefixSize": "/24" ]
}, },
"subnets": { "visible": true
"subnet1": { },
"label": "Subset", {
"defaultValue": { "name": "spSection",
"name": "terraform", "type": "Microsoft.Common.Section",
"addressPrefixSize": "/24" "label": "Service Principal",
}, "elements": [
"constraints": { {
"minAddressPrefixSize": "/30", "name": "principalId",
"minAddressCount": 1, "type": "Microsoft.Common.TextBox",
"requireContiguousAddresses": true "label": "Application ID",
} "defaultValue": "",
} "toolTip": "",
} "constraints": {
} "required": true,
] "regex": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
}, "validationMessage": "Must be a valid UUID."
{ },
"name": "secondStep", "visible": true
"label": "Integration Settings", },
"bladeTitle": "Terraform Integration Settings", {
"subLabel": { "name": "spsecret",
"preValidation": "", "type": "Microsoft.Common.PasswordBox",
"postValidation": "Done" "label": {
}, "password":"Secret",
"elements": [ "confirmPassword": ""
{ },
"name": "sptype", "toolTip": "",
"type": "Microsoft.Common.DropDown", "options": {
"label": "Service Pricipal Integration", "hideConfirmation": true
"defaultValue": "Auto(MSI)", },
"toolTip": "The service pricipal will be added into Terraform as a credential for authenticating with Azure. 'Auto' means that the principal will be created by MSI (Managed Service Identity). 'Manual' means the principal should be created by user and be filled in below.", "visible": true
"constraints": { }
"allowedValues": [ ],
{ "visible": "[equals(steps('firstStep').sptype,'manual')]"
"label": "Auto(MSI)", }
"value": "msi" ]
}, }
{ ],
"label": "Manual", "outputs": {
"value": "manual" "adminPassword": "[basics('authType').password]",
} "adminSSHPublicKey": "[basics('authType').sshPublicKey]",
] "adminUserName": "[basics('userName')]",
}, "authenticationType": "[basics('authType').authenticationType]",
"visible": true "storageAccountType": "[steps('firstStep').vmDiskType]",
}, "vmName": "[basics('vmName')]",
{ "vmSize": "[steps('firstStep').vmSize]",
"name": "spSection", "location": "[location()]",
"type": "Microsoft.Common.Section", "spType": "[steps('firstStep').sptype]",
"label": "Service Principal", "principalId": "[steps('firstStep').spSection.principalId]",
"elements": [ "spSecret": "[steps('firstStep').spSection.spsecret]"
{ }
"name": "principalId", }
"type": "Microsoft.Common.TextBox", }
"label": "Service Principal ID",
"defaultValue": "",
"toolTip": "",
"constraints": {
"required": true,
"regex": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
"validationMessage": "Must be a valid UUID."
},
"visible": true
},
{
"name": "spsecret",
"type": "Microsoft.Common.PasswordBox",
"label": {
"password":"Secret",
"confirmPassword": ""
},
"toolTip": "",
"options": {
"hideConfirmation": true
},
"visible": true
}
],
"visible": "[equals(steps('secondStep').sptype,'manual')]"
},
{
"name": "enableCloudAgents",
"type": "Microsoft.Common.OptionsGroup",
"label": "Enable Cloud Agents",
"defaultValue": "VM",
"toolTip": "Add a default cloud template for agents. ACI: Azure Container Instance, VM: virtual machine.",
"constraints": {
"allowedValues": [
{
"label": "No",
"value": "no"
},
{
"label": "ACI",
"value": "aci"
},
{
"label": "VM",
"value": "vm"
}
]
},
"visible": true
}
]
}
],
"outputs": {
"adminPassword": "[basics('authType').password]",
"adminSSHPublicKey": "[basics('authType').sshPublicKey]",
"adminUserName": "[basics('userName')]",
"authenticationType": "[basics('authType').authenticationType]",
"publicIPName": "[steps('firstStep').publicIP.name]",
"publicIPNewOrExisting": "[steps('firstStep').publicIP.newOrExistingOrNone]",
"publicIPResourceGroup": "[steps('firstStep').publicIP.resourceGroup]",
"storageAccountType": "[steps('firstStep').vmDiskType]",
"vmName": "[basics('vmName')]",
"vmSize": "[steps('firstStep').vmSize]",
"location": "[location()]",
"spType": "[steps('secondStep').sptype]",
"principalId": "[steps('secondStep').spSection.principalId]",
"spSecret": "[steps('secondStep').spSection.spsecret]",
"enableCloudAgents": "[steps('secondStep').enableCloudAgents]",
"vnetName": "[steps('firstStep').vnet.name]",
"vnetResourceGroup": "[steps('firstStep').vnet.resourceGroup]",
"vnetAddressPrefix": "[steps('firstStep').vnet.addressPrefix]",
"vnetNewOrExisting": "[steps('firstStep').vnet.newOrExisting]",
"subnetName": "[steps('firstStep').vnet.subnets.subnet1.name]",
"subnetAddressPrefix": "[steps('firstStep').vnet.subnets.subnet1.addressPrefix]"
}
}
}

View File

@ -1,324 +1,352 @@
{ {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0", "contentVersion": "1.0.0.0",
"parameters": { "parameters": {
"userName": { "artifactsLocation": {
"type": "string", "metadata": {
"metadata": { "artifactsBaseUrl": "",
"description": "Username for the Virtual Machine." "description": "The base URI where artifacts required by this template are located. When the template is deployed using the accompanying scripts, a private location in the subscription will be used and this value will be automatically generated."
} },
}, "defaultValue": "https://raw.githubusercontent.com/Azure/terraform/vm-linux-terraform",
"authenticationType": { "type": "string"
"type": "string", },
"defaultValue": "password", "artifactsLocationSasToken": {
"allowedValues": [ "metadata": {
"password", "description": "The sasToken required to access artifactsLocation. When the template is deployed using the accompanying scripts, a sasToken will be automatically generated."
"sshPublicKey" },
], "defaultValue": "",
"metadata": { "type": "securestring"
"description": "Authentication type" },
} "adminPassword": {
}, "metadata": {
"adminPassword": { "description": "Password for the Virtual Machine. Will be used only if authenticationType is 'password'"
"type": "securestring", },
"defaultValue": "", "defaultValue": "",
"metadata": { "type": "securestring"
"description": "Password for the Virtual Machine." },
} "adminSSHPublicKey": {
}, "metadata": {
"sshPublicKey": { "description": "Public SSH key for the Virtual Machine. Will be used only if authenticationType is 'sshPublicKey'"
"type": "securestring", },
"defaultValue": "", "defaultValue": "",
"metadata": { "type": "string"
"description": "ssh key for the Virtual Machine." },
} "adminUserName": {
}, "metadata": {
"vmSize": { "description": "User name for the Virtual Machine"
"type": "string", },
"metadata": { "type": "string"
"description": "The size of the VM to create" },
}, "authenticationType": {
"defaultValue": "Standard_D1_V2" "metadata": {
}, "description": "Authentication type (can be 'password' or 'sshPublicKey')"
"desktopInstall": { },
"type": "bool", "type": "string"
"defaultValue": false, },
"metadata": { "location": {
"description": "Installs Ubuntu Mate desktop GUI" "metadata": {
} "description": "Azure location where to deploy the resources"
}, },
"_artifactsLocation": { "type": "string",
"type": "string", "defaultValue": "[resourceGroup().location]"
"metadata": { },
"description": "The base URI where artifacts required by this template are located. When the template is deployed using the accompanying scripts, a private location in the subscription will be used and this value will be automatically generated." "storageAccountType": {
}, "defaultValue": "Standard_LRS",
"defaultValue": "https://raw.githubusercontent.com/Azure/terraform/master/solution_template/vm-linux-terraform" "metadata": {
}, "description": "Storage Account Type"
"_artifactsLocationSasToken": { },
"type": "securestring", "type": "string"
"metadata": { },
"description": "The sasToken required to access _artifactsLocation. When the template is deployed using the accompanying scripts, a sasToken will be automatically generated." "principalId":{
}, "defaultValue": "",
"defaultValue": "" "metadata": {
} "description": "The Service Principal Id"
}, },
"variables": { "type": "string"
"dnsLabelPrefix": "[concat('msi',uniquestring(resourceGroup().id))]", },
"infraStorageAccountName": "[take(concat('storeinfra', uniquestring(resourceGroup().id), variables('dnsLabelPrefix')),24)]", "spSecret":{
"stateStorageAccountName": "[take(concat('storestate', uniquestring(resourceGroup().id), variables('dnsLabelPrefix')),24)]", "defaultValue": "",
"nicName": "[concat('nic',uniquestring(resourceGroup().id))]", "metadata": {
"networkSecurityGroupName": "[concat('nsg',uniquestring(resourceGroup().id))]", "description": "The Service Principal secret"
"addressPrefix": "10.0.0.0/16", },
"subnetName": "Subnet", "type": "string"
"subnetPrefix": "10.0.0.0/24", },
"publicIPAddressName": "[concat('pip',uniquestring(resourceGroup().id))]", "spType":{
"vmName": "[concat('vm',uniquestring(resourceGroup().id))]", "defaultValue": "msi",
"virtualNetworkName": "[concat('vnet',uniquestring(resourceGroup().id))]", "metadata": {
"subnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetName'))]", "description": "The type of service principal injected into Terraform (can be 'msi' or 'manual')."
"linuxConfiguration": { },
"disablePasswordAuthentication": true, "type": "string"
"ssh": { },
"publicKeys": [ "vmName": {
{ "metadata": {
"path": "[concat('/home/', parameters('userName'), '/.ssh/authorized_keys')]", "description": "Virtual Machine Name (also used as a prefix for other resources)"
"keyData": "[parameters('sshPublicKey')]" },
} "type": "string",
] "defaultValue": "terraform"
} },
}, "vmSize": {
"contributor" : "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', '8e3af657-a8ff-443c-a75c-2fe8c4bcb635')]", "metadata": {
"installParm1": "[concat(' -u ', parameters('userName'))]", "description": "Virtual Machine Size"
"installParm2": "[concat(' -s ', subscription().subscriptionId)]", },
"installParm3": "[concat(' -a ', variables('stateStorageAccountName'))]", "type": "string",
"installParm4": "[if(equals(parameters('desktopInstall'), bool('true')), concat(' -d ', parameters('desktopInstall')), '')]" "defaultValue": "Standard_DS1_v2"
}
}, },
"resources": [ "variables": {
{ "dnsLabelPrefix": "[concat('msi',uniquestring(resourceGroup().id))]",
"type": "Microsoft.Storage/storageAccounts", "infraStorageAccountName": "[take(concat('storeinfra', uniquestring(resourceGroup().id), variables('dnsLabelPrefix')),24)]",
"name": "[variables('infraStorageAccountName')]", "stateStorageAccountName": "[take(concat('storestate', uniquestring(resourceGroup().id), variables('dnsLabelPrefix')),24)]",
"apiVersion": "2017-10-01", "addressPrefix": "10.0.0.0/16",
"location": "[resourceGroup().location]", "subnetName": "TerraformSubnet",
"sku": { "subnetPrefix": "10.0.0.0/24",
"name": "Standard_LRS" "nicName": "[concat('nic',uniquestring(resourceGroup().id))]",
}, "virtualNetworkName": "[concat('vnet',uniquestring(resourceGroup().id))]",
"kind": "Storage", "subnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetName'))]",
"properties": {} "publicIPAddressName": "[concat('pip',uniquestring(resourceGroup().id))]",
}, "networkSecurityGroupName": "[concat('nsg',uniquestring(resourceGroup().id))]",
{ "linuxConfiguration": {
"type": "Microsoft.Storage/storageAccounts", "disablePasswordAuthentication": true,
"name": "[variables('stateStorageAccountName')]", "ssh": {
"apiVersion": "2017-10-01", "publicKeys": [
"location": "[resourceGroup().location]", {
"sku": { "path": "[concat('/home/', parameters('adminUserName'), '/.ssh/authorized_keys')]",
"name": "Standard_LRS" "keyData": "[parameters('adminSSHPublicKey')]"
}, }
"kind": "Storage", ]
"properties": {} }
}, },
{ "contributor" : "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', '8e3af657-a8ff-443c-a75c-2fe8c4bcb635')]",
"apiVersion": "2017-11-01", "installParm1": "[concat(' -u ', parameters('adminUserName'))]",
"type": "Microsoft.Network/publicIPAddresses", "installParm2": "[concat(' -s ', subscription().subscriptionId)]",
"name": "[variables('publicIPAddressName')]", "installParm3": "[concat(' -a ', variables('stateStorageAccountName'))]"
"location": "[resourceGroup().location]", },
"properties": { "resources": [
"publicIPAllocationMethod": "Dynamic", {
"dnsSettings": { "type": "Microsoft.Storage/storageAccounts",
"domainNameLabel": "[variables('dnsLabelPrefix')]" "name": "[variables('infraStorageAccountName')]",
} "apiVersion": "2017-10-01",
} "location": "[resourceGroup().location]",
}, "sku": {
{ "name": "Standard_LRS"
"apiVersion": "2017-11-01", },
"type": "Microsoft.Network/virtualNetworks", "kind": "Storage",
"name": "[variables('virtualNetworkName')]", "properties": {}
"location": "[resourceGroup().location]", },
"properties": { {
"addressSpace": { "type": "Microsoft.Storage/storageAccounts",
"addressPrefixes": [ "name": "[variables('stateStorageAccountName')]",
"[variables('addressPrefix')]" "apiVersion": "2017-10-01",
] "location": "[resourceGroup().location]",
}, "sku": {
"subnets": [ "name": "Standard_LRS"
{ },
"name": "[variables('subnetName')]", "kind": "Storage",
"properties": { "properties": {}
"addressPrefix": "[variables('subnetPrefix')]" },
} {
} "apiVersion": "2017-11-01",
] "type": "Microsoft.Network/publicIPAddresses",
} "name": "[variables('publicIPAddressName')]",
}, "location": "[resourceGroup().location]",
{ "properties": {
"name": "[variables('networkSecurityGroupName')]", "publicIPAllocationMethod": "Dynamic",
"type": "Microsoft.Network/networkSecurityGroups", "dnsSettings": {
"apiVersion": "2017-11-01", "domainNameLabel": "[variables('dnsLabelPrefix')]"
"location": "[resourceGroup().location]", }
"properties": { }
"securityRules": [ },
{ {
"name": "default-allow-ssh", "apiVersion": "2017-11-01",
"properties": { "type": "Microsoft.Network/virtualNetworks",
"priority": 1000, "name": "[variables('virtualNetworkName')]",
"sourceAddressPrefix": "*", "location": "[resourceGroup().location]",
"protocol": "Tcp", "properties": {
"destinationPortRange": "22", "addressSpace": {
"access": "Allow", "addressPrefixes": [
"direction": "Inbound", "[variables('addressPrefix')]"
"sourcePortRange": "*", ]
"destinationAddressPrefix": "*" },
} "subnets": [
}, {
{ "name": "[variables('subnetName')]",
"name": "rdp-rule", "properties": {
"properties": { "addressPrefix": "[variables('subnetPrefix')]"
"description": "Allow RDP", }
"protocol": "Tcp", }
"sourcePortRange": "*", ]
"destinationPortRange": "3389", }
"sourceAddressPrefix": "Internet", },
"destinationAddressPrefix": "*", {
"access": "Allow", "name": "[variables('networkSecurityGroupName')]",
"priority": 1001, "type": "Microsoft.Network/networkSecurityGroups",
"direction": "Inbound" "apiVersion": "2017-11-01",
} "location": "[resourceGroup().location]",
} "properties": {
] "securityRules": [
} {
}, "name": "default-allow-ssh",
{ "properties": {
"apiVersion": "2017-11-01", "priority": 1000,
"type": "Microsoft.Network/networkInterfaces", "sourceAddressPrefix": "*",
"name": "[variables('nicName')]", "protocol": "Tcp",
"location": "[resourceGroup().location]", "destinationPortRange": "22",
"dependsOn": [ "access": "Allow",
"[resourceId('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]", "direction": "Inbound",
"[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" "sourcePortRange": "*",
], "destinationAddressPrefix": "*"
"properties": { }
"ipConfigurations": [ },
{ {
"name": "ipconfig1", "name": "rdp-rule",
"properties": { "properties": {
"privateIPAllocationMethod": "Dynamic", "description": "Allow RDP",
"publicIPAddress": { "protocol": "Tcp",
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]" "sourcePortRange": "*",
}, "destinationPortRange": "3389",
"subnet": { "sourceAddressPrefix": "Internet",
"id": "[variables('subnetRef')]" "destinationAddressPrefix": "*",
} "access": "Allow",
} "priority": 1001,
} "direction": "Inbound"
], }
"networkSecurityGroup": { }
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]" ]
} }
} },
}, {
{ "apiVersion": "2017-11-01",
"apiVersion": "2017-12-01", "type": "Microsoft.Network/networkInterfaces",
"type": "Microsoft.Compute/virtualMachines", "name": "[variables('nicName')]",
"name": "[variables('vmName')]", "location": "[resourceGroup().location]",
"location": "[resourceGroup().location]", "dependsOn": [
"identity": { "[resourceId('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
"type": "SystemAssigned" "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
}, ],
"properties": { "properties": {
"hardwareProfile": { "ipConfigurations": [
"vmSize": "[parameters('vmSize')]" {
}, "name": "ipconfig1",
"osProfile": { "properties": {
"computerName": "[variables('vmName')]", "privateIPAllocationMethod": "Dynamic",
"adminUsername": "[parameters('userName')]", "publicIPAddress": {
"adminPassword": "[parameters('adminPassword')]", "id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
"linuxConfiguration": "[if(equals(parameters('authenticationType'), 'password'), json('null'), variables('linuxConfiguration'))]" },
}, "subnet": {
"storageProfile": { "id": "[variables('subnetRef')]"
"imageReference": { }
"publisher": "Canonical", }
"offer": "UbuntuServer", }
"sku": "17.10", ],
"version": "latest" "networkSecurityGroup": {
} "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
}, }
"networkProfile": { }
"networkInterfaces": [ },
{ {
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]" "apiVersion": "2017-12-01",
} "type": "Microsoft.Compute/virtualMachines",
] "name": "[parameters('vmName')]",
}, "location": "[resourceGroup().location]",
"diagnosticsProfile": { "identity": {
"bootDiagnostics": { "type": "SystemAssigned"
"enabled": true, },
"storageUri": "[reference(concat('Microsoft.Storage/storageAccounts/', variables('infraStorageAccountName')),'2016-12-01').primaryEndpoints.blob]" "properties": {
} "hardwareProfile": {
} "vmSize": "[parameters('vmSize')]"
} },
}, "osProfile": {
{ "computerName": "[parameters('vmName')]",
"type": "Microsoft.Compute/virtualMachines/extensions", "adminUsername": "[parameters('adminUserName')]",
"name": "[concat(variables('vmName'),'/MSILinuxExtension')]", "adminPassword": "[parameters('adminPassword')]",
"apiVersion": "2017-12-01", "linuxConfiguration": "[if(equals(parameters('authenticationType'), 'password'), json('null'), variables('linuxConfiguration'))]"
"location": "[resourceGroup().location]", },
"dependsOn": [ "storageProfile": {
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]" "imageReference": {
], "publisher": "Canonical",
"properties": { "offer": "UbuntuServer",
"publisher": "Microsoft.ManagedIdentity", "sku": "17.10",
"type": "ManagedIdentityExtensionForLinux", "version": "latest"
"typeHandlerVersion": "1.0", }
"autoUpgradeMinorVersion": true, },
"settings": { "networkProfile": {
"port": 50342 "networkInterfaces": [
}, {
"protectedSettings": {} "id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
} }
}, ]
{ },
"apiVersion": "2017-09-01", "diagnosticsProfile": {
"name": "[guid(resourceGroup().id)]", "bootDiagnostics": {
"type": "Microsoft.Authorization/roleAssignments", "enabled": true,
"dependsOn": [ "storageUri": "[reference(concat('Microsoft.Storage/storageAccounts/', variables('infraStorageAccountName')),'2016-12-01').primaryEndpoints.blob]"
"[resourceId('Microsoft.Compute/virtualMachines/extensions/', variables('vmName'),'MSILinuxExtension')]" }
], }
"properties": { }
"roleDefinitionId": "[variables('contributor')]", },
"principalId": "[reference(concat(resourceId('Microsoft.Compute/virtualMachines/', variables('vmName')),'/providers/Microsoft.ManagedIdentity/Identities/default'),'2015-08-31-PREVIEW').principalId]", {
"scope": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name)]" "type": "Microsoft.Compute/virtualMachines/extensions",
} "name": "[concat(parameters('vmName'),'/MSILinuxExtension')]",
}, "apiVersion": "2017-12-01",
{ "location": "[resourceGroup().location]",
"name": "[concat(variables('vmName'),'/customscriptextension')]", "dependsOn": [
"type": "Microsoft.Compute/virtualMachines/extensions", "[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]"
"apiVersion": "2017-03-30", ],
"location": "[resourceGroup().location]", "properties": {
"dependsOn": [ "publisher": "Microsoft.ManagedIdentity",
"[resourceId('Microsoft.Authorization/roleAssignments', guid(resourceGroup().id))]" "type": "ManagedIdentityExtensionForLinux",
], "typeHandlerVersion": "1.0",
"properties": { "autoUpgradeMinorVersion": true,
"publisher": "Microsoft.Azure.Extensions", "settings": {
"type": "CustomScript", "port": 50342
"typeHandlerVersion": "2.0", },
"autoUpgradeMinorVersion": true, "protectedSettings": {}
"settings": { }
"fileUris": [ },
"[concat(parameters('_artifactsLocation'), '/scripts/infra.sh', parameters('_artifactsLocationSasToken'))]", {
"[concat(parameters('_artifactsLocation'), '/scripts/install.sh', parameters('_artifactsLocationSasToken'))]", "apiVersion": "2017-09-01",
"[concat(parameters('_artifactsLocation'), '/scripts/desktop.sh', parameters('_artifactsLocationSasToken'))]", "name": "[guid(resourceGroup().id)]",
"[concat(parameters('_artifactsLocation'), '/scripts/azureProviderAndCreds.tf', parameters('_artifactsLocationSasToken'))]" "type": "Microsoft.Authorization/roleAssignments",
] "dependsOn": [
}, "[resourceId('Microsoft.Compute/virtualMachines/extensions/', parameters('vmName'),'MSILinuxExtension')]"
"protectedSettings": { ],
"commandToExecute": "[concat('bash infra.sh && bash install.sh ', variables('installParm1'), variables('installParm2'), variables('installParm3'), variables('installParm4'), ' -k ', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('stateStorageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).keys[0].value, ' -l ', reference(concat(resourceId('Microsoft.Compute/virtualMachines/', variables('vmName')),'/providers/Microsoft.ManagedIdentity/Identities/default'),'2015-08-31-PREVIEW').principalId)]" "properties": {
} "roleDefinitionId": "[variables('contributor')]",
} "principalId": "[reference(concat(resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName')),'/providers/Microsoft.ManagedIdentity/Identities/default'),'2015-08-31-PREVIEW').principalId]",
} "scope": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name)]"
], }
"outputs": { },
"fqdn": { {
"value": "[reference(resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName')),'2017-10-01').dnsSettings.fqdn]", "name": "[concat(parameters('vmName'),'/customscriptextension')]",
"type": "string" "type": "Microsoft.Compute/virtualMachines/extensions",
} "apiVersion": "2017-03-30",
} "location": "[resourceGroup().location]",
} "dependsOn": [
"[resourceId('Microsoft.Authorization/roleAssignments', guid(resourceGroup().id))]"
],
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"[concat(parameters('artifactsLocation'), '/scripts/infra.sh', parameters('artifactsLocationSasToken'))]",
"[concat(parameters('artifactsLocation'), '/scripts/install.sh', parameters('artifactsLocationSasToken'))]",
"[concat(parameters('artifactsLocation'), '/scripts/desktop.sh', parameters('artifactsLocationSasToken'))]",
"[concat(parameters('artifactsLocation'), '/scripts/azureProviderAndCreds.tf', parameters('artifactsLocationSasToken'))]"
]
},
"protectedSettings": {
"commandToExecute": "[concat('bash infra.sh && bash install.sh ', variables('installParm1'), variables('installParm2'), variables('installParm3'), ' -k ', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('stateStorageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).keys[0].value, ' -l ', reference(concat(resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName')),'/providers/Microsoft.ManagedIdentity/Identities/default'),'2015-08-31-PREVIEW').principalId)]"
}
}
}
],
"outputs": {
"fqdn": {
"value": "[reference(resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName')),'2017-10-01').dnsSettings.fqdn]",
"type": "string"
}
}
}