Working template
This commit is contained in:
parent
0ba5c18031
commit
f3425a7e04
@ -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",
|
},
|
||||||
"type": "Microsoft.Compute.UserNameTextBox",
|
{
|
||||||
"label": "User name",
|
"name": "userName",
|
||||||
"defaultValue": "",
|
"type": "Microsoft.Compute.UserNameTextBox",
|
||||||
"toolTip": "",
|
"label": "User name",
|
||||||
"constraints": {
|
"defaultValue": "",
|
||||||
"required": true
|
"toolTip": "",
|
||||||
},
|
"constraints": {
|
||||||
"osPlatform": "Linux",
|
"required": true
|
||||||
"visible": true
|
|
||||||
},
|
},
|
||||||
{
|
"osPlatform": "Linux",
|
||||||
"name": "authType",
|
"visible": true
|
||||||
"type": "Microsoft.Compute.CredentialsCombo",
|
},
|
||||||
"label": {
|
{
|
||||||
"authenticationType": "Authentication type",
|
"name": "authType",
|
||||||
"password": "Password",
|
"type": "Microsoft.Compute.CredentialsCombo",
|
||||||
"confirmPassword": "Confirm password",
|
"label": {
|
||||||
"sshPublicKey": "SSH public key"
|
"authenticationType": "Authentication type",
|
||||||
},
|
"password": "Password",
|
||||||
"toolTip": {
|
"confirmPassword": "Confirm password",
|
||||||
"authenticationType": "",
|
"sshPublicKey": "SSH public key"
|
||||||
"password": "",
|
|
||||||
"sshPublicKey": ""
|
|
||||||
},
|
|
||||||
"constraints": {
|
|
||||||
"required": true,
|
|
||||||
"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"
|
|
||||||
},
|
|
||||||
"options": {
|
|
||||||
"hideConfirmation": false,
|
|
||||||
"hidePassword": false
|
|
||||||
},
|
|
||||||
"osPlatform": "Linux",
|
|
||||||
"visible": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"name": "firstStep",
|
|
||||||
"label": "Additional Settings",
|
|
||||||
"bladeTitle": "Additional Settings",
|
|
||||||
"subLabel": {
|
|
||||||
"preValidation": "",
|
|
||||||
"postValidation": "Done"
|
|
||||||
},
|
|
||||||
"elements": [
|
|
||||||
{
|
|
||||||
"name": "vmSize",
|
|
||||||
"type": "Microsoft.Compute.SizeSelector",
|
|
||||||
"label": "Size",
|
|
||||||
"toolTip": "",
|
|
||||||
"recommendedSizes": [
|
|
||||||
"Standard_DS2_v2",
|
|
||||||
"Standard_DS1_v2",
|
|
||||||
"Standard_DS11_v2"
|
|
||||||
],
|
|
||||||
"osPlatform": "Linux",
|
|
||||||
"count": 1,
|
|
||||||
"visible": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "vmDiskType",
|
|
||||||
"type": "Microsoft.Common.OptionsGroup",
|
|
||||||
"label": "VM disk type",
|
|
||||||
"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.",
|
|
||||||
"constraints": {
|
|
||||||
"allowedValues": [
|
|
||||||
{
|
|
||||||
"label": "SSD",
|
|
||||||
"value": "Premium_LRS"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "HDD",
|
|
||||||
"value": "Standard_LRS"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"visible": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "vnet",
|
|
||||||
"type": "Microsoft.Network.VirtualNetworkCombo",
|
|
||||||
"label": {
|
|
||||||
"virtualNetwork": "Virtual network",
|
|
||||||
"subnets": "Subnets"
|
|
||||||
},
|
|
||||||
"toolTip": {
|
|
||||||
"virtualNetwork": "",
|
|
||||||
"subnets": ""
|
|
||||||
},
|
|
||||||
"defaultValue": {
|
|
||||||
"name": "terraform-vnet",
|
|
||||||
"addressPrefixSize": "/16"
|
|
||||||
},
|
|
||||||
"constraints": {
|
|
||||||
"minAddressPrefixSize": "/24"
|
|
||||||
},
|
|
||||||
"subnets": {
|
|
||||||
"subnet1": {
|
|
||||||
"label": "Subset",
|
|
||||||
"defaultValue": {
|
|
||||||
"name": "terraform",
|
|
||||||
"addressPrefixSize": "/24"
|
|
||||||
},
|
|
||||||
"constraints": {
|
|
||||||
"minAddressPrefixSize": "/30",
|
|
||||||
"minAddressCount": 1,
|
|
||||||
"requireContiguousAddresses": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
"toolTip": {
|
||||||
"name": "secondStep",
|
"authenticationType": "",
|
||||||
"label": "Integration Settings",
|
"password": "",
|
||||||
"bladeTitle": "Terraform Integration Settings",
|
"sshPublicKey": ""
|
||||||
"subLabel": {
|
},
|
||||||
"preValidation": "",
|
"constraints": {
|
||||||
"postValidation": "Done"
|
"required": true,
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"hideConfirmation": false,
|
||||||
|
"hidePassword": false
|
||||||
|
},
|
||||||
|
"osPlatform": "Linux",
|
||||||
|
"visible": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"name": "firstStep",
|
||||||
|
"label": "Virtual Machine Settings",
|
||||||
|
"bladeTitle": "Virtual Machine Settings",
|
||||||
|
"subLabel": {
|
||||||
|
"preValidation": "",
|
||||||
|
"postValidation": "Done"
|
||||||
|
},
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"name": "vmSize",
|
||||||
|
"type": "Microsoft.Compute.SizeSelector",
|
||||||
|
"label": "Size",
|
||||||
|
"toolTip": "",
|
||||||
|
"recommendedSizes": [
|
||||||
|
"Standard_DS2_v2",
|
||||||
|
"Standard_DS1_v2",
|
||||||
|
"Standard_DS11_v2"
|
||||||
|
],
|
||||||
|
"osPlatform": "Linux",
|
||||||
|
"count": 1,
|
||||||
|
"visible": true
|
||||||
},
|
},
|
||||||
"elements": [
|
{
|
||||||
{
|
"name": "vmDiskType",
|
||||||
"name": "sptype",
|
"type": "Microsoft.Common.OptionsGroup",
|
||||||
"type": "Microsoft.Common.DropDown",
|
"label": "VM disk type",
|
||||||
"label": "Service Pricipal Integration",
|
"defaultValue": "SSD",
|
||||||
"defaultValue": "Auto(MSI)",
|
"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": "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": {
|
||||||
"constraints": {
|
"allowedValues": [
|
||||||
"allowedValues": [
|
|
||||||
{
|
|
||||||
"label": "Auto(MSI)",
|
|
||||||
"value": "msi"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Manual",
|
|
||||||
"value": "manual"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"visible": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "spSection",
|
|
||||||
"type": "Microsoft.Common.Section",
|
|
||||||
"label": "Service Principal",
|
|
||||||
"elements": [
|
|
||||||
{
|
{
|
||||||
"name": "principalId",
|
"label": "SSD",
|
||||||
"type": "Microsoft.Common.TextBox",
|
"value": "Premium_LRS"
|
||||||
"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",
|
"label": "HDD",
|
||||||
"type": "Microsoft.Common.PasswordBox",
|
"value": "Standard_LRS"
|
||||||
"label": {
|
|
||||||
"password":"Secret",
|
|
||||||
"confirmPassword": ""
|
|
||||||
},
|
|
||||||
"toolTip": "",
|
|
||||||
"options": {
|
|
||||||
"hideConfirmation": true
|
|
||||||
},
|
|
||||||
"visible": true
|
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"visible": "[equals(steps('secondStep').sptype,'manual')]"
|
|
||||||
},
|
},
|
||||||
{
|
"visible": true
|
||||||
"name": "enableCloudAgents",
|
},
|
||||||
"type": "Microsoft.Common.OptionsGroup",
|
{
|
||||||
"label": "Enable Cloud Agents",
|
"name": "sptype",
|
||||||
"defaultValue": "VM",
|
"type": "Microsoft.Common.DropDown",
|
||||||
"toolTip": "Add a default cloud template for agents. ACI: Azure Container Instance, VM: virtual machine.",
|
"label": "Service Principal Integration",
|
||||||
"constraints": {
|
"defaultValue": "Auto(MSI)",
|
||||||
"allowedValues": [
|
"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": {
|
||||||
"label": "No",
|
"allowedValues": [
|
||||||
"value": "no"
|
{
|
||||||
},
|
"label": "Auto(MSI)",
|
||||||
{
|
"value": "msi"
|
||||||
"label": "ACI",
|
},
|
||||||
"value": "aci"
|
{
|
||||||
},
|
"label": "Manual",
|
||||||
{
|
"value": "manual"
|
||||||
"label": "VM",
|
}
|
||||||
"value": "vm"
|
]
|
||||||
}
|
},
|
||||||
]
|
"visible": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "spSection",
|
||||||
|
"type": "Microsoft.Common.Section",
|
||||||
|
"label": "Service Principal",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"name": "principalId",
|
||||||
|
"type": "Microsoft.Common.TextBox",
|
||||||
|
"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."
|
||||||
|
},
|
||||||
|
"visible": true
|
||||||
},
|
},
|
||||||
"visible": true
|
{
|
||||||
}
|
"name": "spsecret",
|
||||||
]
|
"type": "Microsoft.Common.PasswordBox",
|
||||||
}
|
"label": {
|
||||||
],
|
"password":"Secret",
|
||||||
"outputs": {
|
"confirmPassword": ""
|
||||||
"adminPassword": "[basics('authType').password]",
|
},
|
||||||
"adminSSHPublicKey": "[basics('authType').sshPublicKey]",
|
"toolTip": "",
|
||||||
"adminUserName": "[basics('userName')]",
|
"options": {
|
||||||
"authenticationType": "[basics('authType').authenticationType]",
|
"hideConfirmation": true
|
||||||
"publicIPName": "[steps('firstStep').publicIP.name]",
|
},
|
||||||
"publicIPNewOrExisting": "[steps('firstStep').publicIP.newOrExistingOrNone]",
|
"visible": true
|
||||||
"publicIPResourceGroup": "[steps('firstStep').publicIP.resourceGroup]",
|
}
|
||||||
"storageAccountType": "[steps('firstStep').vmDiskType]",
|
],
|
||||||
"vmName": "[basics('vmName')]",
|
"visible": "[equals(steps('firstStep').sptype,'manual')]"
|
||||||
"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]"
|
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"outputs": {
|
||||||
|
"adminPassword": "[basics('authType').password]",
|
||||||
|
"adminSSHPublicKey": "[basics('authType').sshPublicKey]",
|
||||||
|
"adminUserName": "[basics('userName')]",
|
||||||
|
"authenticationType": "[basics('authType').authenticationType]",
|
||||||
|
"storageAccountType": "[steps('firstStep').vmDiskType]",
|
||||||
|
"vmName": "[basics('vmName')]",
|
||||||
|
"vmSize": "[steps('firstStep').vmSize]",
|
||||||
|
"location": "[location()]",
|
||||||
|
"spType": "[steps('firstStep').sptype]",
|
||||||
|
"principalId": "[steps('firstStep').spSection.principalId]",
|
||||||
|
"spSecret": "[steps('firstStep').spSection.spsecret]"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -2,96 +2,124 @@
|
|||||||
"$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": {
|
|
||||||
"description": "Username for the Virtual Machine."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"authenticationType": {
|
|
||||||
"type": "string",
|
|
||||||
"defaultValue": "password",
|
|
||||||
"allowedValues": [
|
|
||||||
"password",
|
|
||||||
"sshPublicKey"
|
|
||||||
],
|
|
||||||
"metadata": {
|
|
||||||
"description": "Authentication type"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"adminPassword": {
|
|
||||||
"type": "securestring",
|
|
||||||
"defaultValue": "",
|
|
||||||
"metadata": {
|
|
||||||
"description": "Password for the Virtual Machine."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"sshPublicKey": {
|
|
||||||
"type": "securestring",
|
|
||||||
"defaultValue": "",
|
|
||||||
"metadata": {
|
|
||||||
"description": "ssh key for the Virtual Machine."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"vmSize": {
|
|
||||||
"type": "string",
|
|
||||||
"metadata": {
|
|
||||||
"description": "The size of the VM to create"
|
|
||||||
},
|
|
||||||
"defaultValue": "Standard_D1_V2"
|
|
||||||
},
|
|
||||||
"desktopInstall": {
|
|
||||||
"type": "bool",
|
|
||||||
"defaultValue": false,
|
|
||||||
"metadata": {
|
|
||||||
"description": "Installs Ubuntu Mate desktop GUI"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"_artifactsLocation": {
|
|
||||||
"type": "string",
|
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
"artifactsBaseUrl": "",
|
||||||
"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."
|
"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/master/solution_template/vm-linux-terraform"
|
"defaultValue": "https://raw.githubusercontent.com/Azure/terraform/vm-linux-terraform",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
"_artifactsLocationSasToken": {
|
"artifactsLocationSasToken": {
|
||||||
"type": "securestring",
|
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"description": "The sasToken required to access _artifactsLocation. When the template is deployed using the accompanying scripts, a sasToken will be automatically generated."
|
"description": "The sasToken required to access artifactsLocation. When the template is deployed using the accompanying scripts, a sasToken will be automatically generated."
|
||||||
},
|
},
|
||||||
"defaultValue": ""
|
"defaultValue": "",
|
||||||
|
"type": "securestring"
|
||||||
|
},
|
||||||
|
"adminPassword": {
|
||||||
|
"metadata": {
|
||||||
|
"description": "Password for the Virtual Machine. Will be used only if authenticationType is 'password'"
|
||||||
|
},
|
||||||
|
"defaultValue": "",
|
||||||
|
"type": "securestring"
|
||||||
|
},
|
||||||
|
"adminSSHPublicKey": {
|
||||||
|
"metadata": {
|
||||||
|
"description": "Public SSH key for the Virtual Machine. Will be used only if authenticationType is 'sshPublicKey'"
|
||||||
|
},
|
||||||
|
"defaultValue": "",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"adminUserName": {
|
||||||
|
"metadata": {
|
||||||
|
"description": "User name for the Virtual Machine"
|
||||||
|
},
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"authenticationType": {
|
||||||
|
"metadata": {
|
||||||
|
"description": "Authentication type (can be 'password' or 'sshPublicKey')"
|
||||||
|
},
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"location": {
|
||||||
|
"metadata": {
|
||||||
|
"description": "Azure location where to deploy the resources"
|
||||||
|
},
|
||||||
|
"type": "string",
|
||||||
|
"defaultValue": "[resourceGroup().location]"
|
||||||
|
},
|
||||||
|
"storageAccountType": {
|
||||||
|
"defaultValue": "Standard_LRS",
|
||||||
|
"metadata": {
|
||||||
|
"description": "Storage Account Type"
|
||||||
|
},
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"principalId":{
|
||||||
|
"defaultValue": "",
|
||||||
|
"metadata": {
|
||||||
|
"description": "The Service Principal Id"
|
||||||
|
},
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"spSecret":{
|
||||||
|
"defaultValue": "",
|
||||||
|
"metadata": {
|
||||||
|
"description": "The Service Principal secret"
|
||||||
|
},
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"spType":{
|
||||||
|
"defaultValue": "msi",
|
||||||
|
"metadata": {
|
||||||
|
"description": "The type of service principal injected into Terraform (can be 'msi' or 'manual')."
|
||||||
|
},
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"vmName": {
|
||||||
|
"metadata": {
|
||||||
|
"description": "Virtual Machine Name (also used as a prefix for other resources)"
|
||||||
|
},
|
||||||
|
"type": "string",
|
||||||
|
"defaultValue": "terraform"
|
||||||
|
},
|
||||||
|
"vmSize": {
|
||||||
|
"metadata": {
|
||||||
|
"description": "Virtual Machine Size"
|
||||||
|
},
|
||||||
|
"type": "string",
|
||||||
|
"defaultValue": "Standard_DS1_v2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"variables": {
|
"variables": {
|
||||||
"dnsLabelPrefix": "[concat('msi',uniquestring(resourceGroup().id))]",
|
"dnsLabelPrefix": "[concat('msi',uniquestring(resourceGroup().id))]",
|
||||||
"infraStorageAccountName": "[take(concat('storeinfra', uniquestring(resourceGroup().id), variables('dnsLabelPrefix')),24)]",
|
"infraStorageAccountName": "[take(concat('storeinfra', uniquestring(resourceGroup().id), variables('dnsLabelPrefix')),24)]",
|
||||||
"stateStorageAccountName": "[take(concat('storestate', uniquestring(resourceGroup().id), variables('dnsLabelPrefix')),24)]",
|
"stateStorageAccountName": "[take(concat('storestate', uniquestring(resourceGroup().id), variables('dnsLabelPrefix')),24)]",
|
||||||
"nicName": "[concat('nic',uniquestring(resourceGroup().id))]",
|
|
||||||
"networkSecurityGroupName": "[concat('nsg',uniquestring(resourceGroup().id))]",
|
|
||||||
"addressPrefix": "10.0.0.0/16",
|
"addressPrefix": "10.0.0.0/16",
|
||||||
"subnetName": "Subnet",
|
"subnetName": "TerraformSubnet",
|
||||||
"subnetPrefix": "10.0.0.0/24",
|
"subnetPrefix": "10.0.0.0/24",
|
||||||
"publicIPAddressName": "[concat('pip',uniquestring(resourceGroup().id))]",
|
"nicName": "[concat('nic',uniquestring(resourceGroup().id))]",
|
||||||
"vmName": "[concat('vm',uniquestring(resourceGroup().id))]",
|
|
||||||
"virtualNetworkName": "[concat('vnet',uniquestring(resourceGroup().id))]",
|
"virtualNetworkName": "[concat('vnet',uniquestring(resourceGroup().id))]",
|
||||||
"subnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetName'))]",
|
"subnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetName'))]",
|
||||||
|
"publicIPAddressName": "[concat('pip',uniquestring(resourceGroup().id))]",
|
||||||
|
"networkSecurityGroupName": "[concat('nsg',uniquestring(resourceGroup().id))]",
|
||||||
"linuxConfiguration": {
|
"linuxConfiguration": {
|
||||||
"disablePasswordAuthentication": true,
|
"disablePasswordAuthentication": true,
|
||||||
"ssh": {
|
"ssh": {
|
||||||
"publicKeys": [
|
"publicKeys": [
|
||||||
{
|
{
|
||||||
"path": "[concat('/home/', parameters('userName'), '/.ssh/authorized_keys')]",
|
"path": "[concat('/home/', parameters('adminUserName'), '/.ssh/authorized_keys')]",
|
||||||
"keyData": "[parameters('sshPublicKey')]"
|
"keyData": "[parameters('adminSSHPublicKey')]"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"contributor" : "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', '8e3af657-a8ff-443c-a75c-2fe8c4bcb635')]",
|
"contributor" : "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', '8e3af657-a8ff-443c-a75c-2fe8c4bcb635')]",
|
||||||
"installParm1": "[concat(' -u ', parameters('userName'))]",
|
"installParm1": "[concat(' -u ', parameters('adminUserName'))]",
|
||||||
"installParm2": "[concat(' -s ', subscription().subscriptionId)]",
|
"installParm2": "[concat(' -s ', subscription().subscriptionId)]",
|
||||||
"installParm3": "[concat(' -a ', variables('stateStorageAccountName'))]",
|
"installParm3": "[concat(' -a ', variables('stateStorageAccountName'))]"
|
||||||
"installParm4": "[if(equals(parameters('desktopInstall'), bool('true')), concat(' -d ', parameters('desktopInstall')), '')]"
|
|
||||||
|
|
||||||
},
|
},
|
||||||
"resources": [
|
"resources": [
|
||||||
{
|
{
|
||||||
@ -202,7 +230,7 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"privateIPAllocationMethod": "Dynamic",
|
"privateIPAllocationMethod": "Dynamic",
|
||||||
"publicIPAddress": {
|
"publicIPAddress": {
|
||||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
|
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
|
||||||
},
|
},
|
||||||
"subnet": {
|
"subnet": {
|
||||||
"id": "[variables('subnetRef')]"
|
"id": "[variables('subnetRef')]"
|
||||||
@ -218,7 +246,7 @@
|
|||||||
{
|
{
|
||||||
"apiVersion": "2017-12-01",
|
"apiVersion": "2017-12-01",
|
||||||
"type": "Microsoft.Compute/virtualMachines",
|
"type": "Microsoft.Compute/virtualMachines",
|
||||||
"name": "[variables('vmName')]",
|
"name": "[parameters('vmName')]",
|
||||||
"location": "[resourceGroup().location]",
|
"location": "[resourceGroup().location]",
|
||||||
"identity": {
|
"identity": {
|
||||||
"type": "SystemAssigned"
|
"type": "SystemAssigned"
|
||||||
@ -228,8 +256,8 @@
|
|||||||
"vmSize": "[parameters('vmSize')]"
|
"vmSize": "[parameters('vmSize')]"
|
||||||
},
|
},
|
||||||
"osProfile": {
|
"osProfile": {
|
||||||
"computerName": "[variables('vmName')]",
|
"computerName": "[parameters('vmName')]",
|
||||||
"adminUsername": "[parameters('userName')]",
|
"adminUsername": "[parameters('adminUserName')]",
|
||||||
"adminPassword": "[parameters('adminPassword')]",
|
"adminPassword": "[parameters('adminPassword')]",
|
||||||
"linuxConfiguration": "[if(equals(parameters('authenticationType'), 'password'), json('null'), variables('linuxConfiguration'))]"
|
"linuxConfiguration": "[if(equals(parameters('authenticationType'), 'password'), json('null'), variables('linuxConfiguration'))]"
|
||||||
},
|
},
|
||||||
@ -258,11 +286,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "Microsoft.Compute/virtualMachines/extensions",
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
||||||
"name": "[concat(variables('vmName'),'/MSILinuxExtension')]",
|
"name": "[concat(parameters('vmName'),'/MSILinuxExtension')]",
|
||||||
"apiVersion": "2017-12-01",
|
"apiVersion": "2017-12-01",
|
||||||
"location": "[resourceGroup().location]",
|
"location": "[resourceGroup().location]",
|
||||||
"dependsOn": [
|
"dependsOn": [
|
||||||
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
|
"[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"publisher": "Microsoft.ManagedIdentity",
|
"publisher": "Microsoft.ManagedIdentity",
|
||||||
@ -280,16 +308,16 @@
|
|||||||
"name": "[guid(resourceGroup().id)]",
|
"name": "[guid(resourceGroup().id)]",
|
||||||
"type": "Microsoft.Authorization/roleAssignments",
|
"type": "Microsoft.Authorization/roleAssignments",
|
||||||
"dependsOn": [
|
"dependsOn": [
|
||||||
"[resourceId('Microsoft.Compute/virtualMachines/extensions/', variables('vmName'),'MSILinuxExtension')]"
|
"[resourceId('Microsoft.Compute/virtualMachines/extensions/', parameters('vmName'),'MSILinuxExtension')]"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"roleDefinitionId": "[variables('contributor')]",
|
"roleDefinitionId": "[variables('contributor')]",
|
||||||
"principalId": "[reference(concat(resourceId('Microsoft.Compute/virtualMachines/', variables('vmName')),'/providers/Microsoft.ManagedIdentity/Identities/default'),'2015-08-31-PREVIEW').principalId]",
|
"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)]"
|
"scope": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name)]"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "[concat(variables('vmName'),'/customscriptextension')]",
|
"name": "[concat(parameters('vmName'),'/customscriptextension')]",
|
||||||
"type": "Microsoft.Compute/virtualMachines/extensions",
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
||||||
"apiVersion": "2017-03-30",
|
"apiVersion": "2017-03-30",
|
||||||
"location": "[resourceGroup().location]",
|
"location": "[resourceGroup().location]",
|
||||||
@ -303,14 +331,14 @@
|
|||||||
"autoUpgradeMinorVersion": true,
|
"autoUpgradeMinorVersion": true,
|
||||||
"settings": {
|
"settings": {
|
||||||
"fileUris": [
|
"fileUris": [
|
||||||
"[concat(parameters('_artifactsLocation'), '/scripts/infra.sh', parameters('_artifactsLocationSasToken'))]",
|
"[concat(parameters('artifactsLocation'), '/scripts/infra.sh', parameters('artifactsLocationSasToken'))]",
|
||||||
"[concat(parameters('_artifactsLocation'), '/scripts/install.sh', parameters('_artifactsLocationSasToken'))]",
|
"[concat(parameters('artifactsLocation'), '/scripts/install.sh', parameters('artifactsLocationSasToken'))]",
|
||||||
"[concat(parameters('_artifactsLocation'), '/scripts/desktop.sh', parameters('_artifactsLocationSasToken'))]",
|
"[concat(parameters('artifactsLocation'), '/scripts/desktop.sh', parameters('artifactsLocationSasToken'))]",
|
||||||
"[concat(parameters('_artifactsLocation'), '/scripts/azureProviderAndCreds.tf', parameters('_artifactsLocationSasToken'))]"
|
"[concat(parameters('artifactsLocation'), '/scripts/azureProviderAndCreds.tf', parameters('artifactsLocationSasToken'))]"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"protectedSettings": {
|
"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)]"
|
"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)]"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user