Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
titleazuredeploy.json
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "NamingPrefix": {
      "type": "string",
      "minLength": 3,
      "maxLength": 16,
      "defaultValue": "DEVWINMCVMSS",
      "metadata": {
        "description": "VM Naming Prefix"
      }
    },
    "NamingPostfix": {
      "type": "string",
      "defaultValue": "01",
      "maxLength": 2,
      "metadata": {
        "description": "VM Naming Postfix"
      }
    },
    "LocalAdminUser": {
      "type": "string",
      "defaultValue": "XXX",
      "metadata": {
        "description": "Username for the local admin user"
      }
    },
    "LocalAdminPassword": {
      "type": "securestring",
      "defaultValue": "XXXdummy_encrypted_password",
      "metadata": {
        "description": "Password for the local admin user"
      }
    },
    "VMSize": {
      "type": "string",
      "allowedValues": [
        "Standard_D4s_v5",
        "Standard_B2s",
        "Standard_B2ms",
        "Standard_B4ms",
        "Standard_B8ms",
        "Standard_D2s_v3",
        "Standard_D4s_v3",
        "Standard_D8s_v3"
      ],
      "defaultValue": "Standard_B2s",
      "metadata": {
        "description": "VM Size SKU."
      }
    },
    "VnetResourceID": {
      "type": "string",
      "defaultValue": "fewsmc00-vnet",
      "metadata": {
        "description": "Resource ID of the Vnet that you would like the VM's NIC to be placed in"
      }
    },
    "SubNetName": {
      "type": "string",
      "defaultValue": "PrivateSubnet",
      "metadata": {
        "description": "the name of the subnet that this VM will placed in"
      }
    },
    "OSVersion": {
      "type": "string",
      "defaultValue": "2019-Datacenter-smalldisk",
      "allowedValues": [
        "2019-Datacenter",
        "2019-Datacenter-smalldisk"
      ],
      "metadata": {
        "description": "The Windows version for the VM. This will pick a fully patched image of this given Windows version. Using the small disk allow creating a c: drive from 32GBytes and up."
      }
    },
    "DiskSizeGB": {
      "type": "string",
      "defaultValue": "32",
      "metadata": {
        "description": "The size of the OS Disk."
      }
    },
    "FewsBaseBuildUrl": {
      "type": "string",
      "defaultValue": "https://myblobstorage.blob.core.windows.net/delft-fews-base-builds/fews-development-202302-121196-bin.zip",
      "metadata": {
        "description": "Basbuild distribution URL"
      }
    },
    "DatabaseUrl": {
      "type": "string",
      "defaultValue": "XXX",
      "metadata": {
        "description": "Database URL. Use a database URL with credentials encoded. The URL can be stored in Azure Keyvault."
      }
    },
    "ResourceTags": {
      "type": "object",
      "defaultValue": {
        "mc": "high available mc using a vmss"
      }
    }
  },
  "variables": {
    "Location": "[resourceGroup().location]",
    "SubnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('VnetResourceID'), parameters('SubNetName'))]",
    "VMNameScaleSet": "[concat(parameters('NamingPrefix'), parameters('NamingPostfix'))]",
    "env": {
           "FEWS_MC_HOME_DIR": "c:/fews/mc",
           "FEWS_MC_MC00_DATABASE_URL": "[parameters('DatabaseUrl')]"
           },
    "installScript": "Start-BitsTransfer -Source \"__BASEBUILD_DISTRIBUTION_URL__\" -Destination \"c:\\bin.zip\"\nExpand-Archive \"c:\\bin.zip\" -DestinationPath \"c:\\fews\\bin\";\nRemove-Item -Path \"c:\\bin.zip\";\nc:\\fews\\bin\\windows\\setEnvFromJsonBase64.ps1 \"__BASE64_ENV_VARIABLES__\";\nc:\\fews\\bin\\windows\\mcLauncherRegisterService.bat\nc:\\fews\\bin\\windows\\mcLauncherStartService.bat",
    "installData": "[replace(replace(variables('installScript'),'__BASE64_ENV_VARIABLES__',base64(string(variables('env')))),'__BASEBUILD_DISTRIBUTION_URL__',parameters('FewsBaseBuildUrl'))]"
  },
  "resources": [
    {
      "name": "[variables('VMNameScaleSet')]",
      "type": "Microsoft.Compute/virtualMachineScaleSets",
      "apiVersion": "2022-03-01",
      "zones": ["1", "2", "3"],
      "sku": {
        "name": "[parameters('VMSize')]",
        "capacity": 1,
        "tier": "Standard"
      },
      "location": "[variables('Location')]",
      "tags": "[parameters('ResourceTags')]",
      "properties": {
         "overprovision": false,
          "upgradePolicy": {
          "mode": "Manual"
        },
        "virtualMachineProfile": {
          "osProfile": {
            "computerNamePrefix": "MC",
            "adminUsername": "[parameters('LocalAdminUser')]",
            "adminPassword": "[parameters('LocalAdminPassword')]",
            "customData": "[base64(variables('installData'))]"
          },
        "storageProfile": {
          "imageReference": {
            "publisher": "MicrosoftWindowsServer",
            "offer": "WindowsServer",
            "sku": "[parameters('OSVersion')]",
            "version": "latest"
          },
          "osDisk": {         
            "caching": "ReadWrite",
            "createOption": "FromImage",
            "diskSizeGB": "[parameters('DiskSizeGB')]",
            "managedDisk": {
              "storageAccountType": "Premium_LRS"
            }
          },
          "dataDisks": [
          ]
        },
        "extensionProfile": {
            "extensions": [
              {
                "name": "DelftFewsMasterControllerInstaller",
                "properties": {
                    "publisher": "Microsoft.Compute",
                    "type": "CustomScriptExtension",
                    "typeHandlerVersion": "1.10",
                    "autoUpgradeMinorVersion": true,
                    "protectedSettings": {
                      "commandToExecute": "powershell -ExecutionPolicy Unrestricted < %SYSTEMDRIVE%\\AzureData\\CustomData.bin  && del /f %SYSTEMDRIVE%\\AzureData\\CustomData.bin"
                    }

                }
              }
            ]
        },
        "networkProfile": {
            "networkInterfaceConfigurations": [
              {
                "name": "nic-config",
                "properties": {
                  "primary": true,
                  "ipConfigurations": [
                      {
                          "name": "ipconfig1",
                          "properties": {
                              "subnet": {
                                  "id": "[variables('SubnetRef')]"
                              }
                          }
                      }
                  ]
                }
              }
            ]
          }
        }
       }
    }
  ]
}  

...