You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
3.2 KiB

  1. {
  2. "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  3. "contentVersion": "1.0.0.0",
  4. "parameters": {
  5. },
  6. "variables": {
  7. "vnetID": "[resourceId('Microsoft.Network/virtualNetworks', '{{virtualNetworkName}}')]",
  8. "subnetAdminRef": "[concat(variables('vnetID'),'/subnets/', '{{subnetAdminName}}')]"
  9. },
  10. "resources": [
  11. {% if use_bastion %}
  12. {
  13. "apiVersion": "{{apiVersion}}",
  14. "type": "Microsoft.Network/publicIPAddresses",
  15. "name": "{{bastionIPAddressName}}",
  16. "location": "[resourceGroup().location]",
  17. "properties": {
  18. "publicIPAllocationMethod": "Static",
  19. "dnsSettings": {
  20. {% if bastion_domain_prefix %}
  21. "domainNameLabel": "{{ bastion_domain_prefix }}"
  22. {% endif %}
  23. }
  24. }
  25. },
  26. {
  27. "apiVersion": "{{apiVersion}}",
  28. "type": "Microsoft.Network/networkInterfaces",
  29. "name": "{{bastionVMName}}-nic",
  30. "location": "[resourceGroup().location]",
  31. "dependsOn": [
  32. "[concat('Microsoft.Network/publicIPAddresses/', '{{bastionIPAddressName}}')]"
  33. ],
  34. "properties": {
  35. "ipConfigurations": [
  36. {
  37. "name": "BastionIpConfig",
  38. "properties": {
  39. "privateIPAllocationMethod": "Dynamic",
  40. "publicIPAddress": {
  41. "id": "[resourceId('Microsoft.Network/publicIPAddresses', '{{bastionIPAddressName}}')]"
  42. },
  43. "subnet": {
  44. "id": "[variables('subnetAdminRef')]"
  45. }
  46. }
  47. }
  48. ]
  49. }
  50. },
  51. {
  52. "apiVersion": "{{apiVersion}}",
  53. "type": "Microsoft.Compute/virtualMachines",
  54. "name": "{{bastionVMName}}",
  55. "location": "[resourceGroup().location]",
  56. "dependsOn": [
  57. "[concat('Microsoft.Network/networkInterfaces/', '{{bastionVMName}}-nic')]"
  58. ],
  59. "tags": {
  60. "roles": "bastion"
  61. },
  62. "properties": {
  63. "hardwareProfile": {
  64. "vmSize": "{{bastionVmSize}}"
  65. },
  66. "osProfile": {
  67. "computerName": "{{bastionVMName}}",
  68. "adminUsername": "{{admin_username}}",
  69. "adminPassword": "{{admin_password}}",
  70. "linuxConfiguration": {
  71. "disablePasswordAuthentication": "true",
  72. "ssh": {
  73. "publicKeys": [
  74. {% for key in ssh_public_keys %}
  75. {
  76. "path": "{{sshKeyPath}}",
  77. "keyData": "{{key}}"
  78. }{% if loop.index < ssh_public_keys | length %},{% endif %}
  79. {% endfor %}
  80. ]
  81. }
  82. }
  83. },
  84. "storageProfile": {
  85. "imageReference": {{imageReferenceJson}},
  86. "osDisk": {
  87. "name": "osdisk",
  88. "vhd": {
  89. "uri": "[concat('http://', '{{storageAccountName}}', '.blob.core.windows.net/vhds/', '{{bastionVMName}}', '-osdisk.vhd')]"
  90. },
  91. "caching": "ReadWrite",
  92. "createOption": "FromImage"
  93. }
  94. },
  95. "networkProfile": {
  96. "networkInterfaces": [
  97. {
  98. "id": "[resourceId('Microsoft.Network/networkInterfaces', '{{bastionVMName}}-nic')]"
  99. }
  100. ]
  101. }
  102. }
  103. }
  104. {% endif %}
  105. ]
  106. }