Azure Compute Virtual Machine Scale Set

This page shows how to write Terraform and Azure Resource Manager for Compute Virtual Machine Scale Set and write them securely.

azurerm_virtual_machine_scale_set (Terraform)

The Virtual Machine Scale Set in Compute can be configured in Terraform with the resource name azurerm_virtual_machine_scale_set. The following sections describe 6 examples of how to use the resource and its parameters.

Example Usage from GitHub

import.tf#L19
resource "azurerm_virtual_machine_scale_set" "vmss" {
 name                = "vmss-obb-stage-unistad-001"
}


### To import we only need to create the resource : resource "azurerm_virtual_machine_scale_set" "vmss" {
main.tf#L43
resource "azurerm_virtual_machine_scale_set" "vmss-app" {
 name                = "vmscaleset-app"
 location            = var.location
 resource_group_name = var.resource_group
 upgrade_policy_mode = "Manual"

virtual_machine_scale_set_test.tf#L25
resource "azurerm_virtual_machine_scale_set" "linux" {
  name                = "mytestscaleset-1"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name

  upgrade_policy_mode = "Manual"
Main.tf#L9
resource "azurerm_virtual_machine_scale_set" "TerraVMSS" {
  name                = var.VMSSName
  location            = var.VMSSRegion
  resource_group_name = var.VMSSRGName
  sku                 = var.LBSku

myVMSS.tf#L1
resource "azurerm_virtual_machine_scale_set" "user21vmss" {
name = "user21vmss"
location = azurerm_resource_group.user21-rg.location
resource_group_name = azurerm_resource_group.user21-rg.name

upgrade_policy_mode = "Manual"
vmss.tf#L1
resource "azurerm_virtual_machine_scale_set" "vmss" {
  name                = "vmscaleset"
  location            = var.location
  resource_group_name = azurerm_resource_group.vmss.name
  upgrade_policy_mode = "Manual"

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages a virtual machine scale set.

Tips: Best Practices for The Other Azure Compute Resources

In addition to the azurerm_linux_virtual_machine, Azure Compute has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.

risk-label

azurerm_linux_virtual_machine

Ensure to use SSH authentication for virtual machines

It is better to use SSH authentication for virtual machines instead of password authentication to enforce more secure ways.

risk-label

azurerm_managed_disk

Ensure to enable the encryption on managed disks

It is better to enable the encryption on managed disks.

risk-label

azurerm_virtual_machine

Ensure to use SSH authentication for virtual machines

It is better to use SSH authentication for virtual machines instead of password authentication to enforce more secure ways.

Review your Azure Compute settings

In addition to the above, there are other security points you should be aware of making sure that your .tf files are protected in Shisho Cloud.

Microsoft.Compute/virtualMachineScaleSets (Azure Resource Manager)

The virtualMachineScaleSets in Microsoft.Compute can be configured in Azure Resource Manager with the resource name Microsoft.Compute/virtualMachineScaleSets. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

deploy-extseq-windows-ADE-after-customscript.json#L65
            "type": "Microsoft.Compute/virtualMachineScaleSets",
            "name": "[parameters('vmssName')]",
            "location": "[resourceGroup().location]",
            "apiVersion": "2018-06-01",
            "properties": {
                "virtualMachineProfile": {
deploy-extseq-windows-CustomScript-after-ADE.json#L65
            "type": "Microsoft.Compute/virtualMachineScaleSets",
            "name": "[parameters('vmssName')]",
            "location": "[resourceGroup().location]",
            "apiVersion": "2018-06-01",
            "properties": {
                "virtualMachineProfile": {
rules.json#L6
                "equals": "Microsoft.Compute/virtualMachineScaleSets"
            },
            {
                "field": "Microsoft.Compute/VirtualMachineScaleSets/osProfile.linuxConfiguration",
                "exists": "true"
            }

Parameters

  • apiVersion required - string
  • extendedLocation optional
      • name optional - string

        The name of the extended location.

      • type optional - string

        The type of the extended location.

  • identity optional
      • type optional - string

        The type of identity used for the virtual machine scale set. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the virtual machine scale set.

      • userAssignedIdentities optional - undefined

        The list of user identities associated with the virtual machine scale set. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.

  • location required - string

    Resource location

  • name required - string

    The name of the VM scale set to create or update.

  • plan optional
      • name optional - string

        The plan ID.

      • product optional - string

        Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element.

      • promotionCode optional - string

        The promotion code.

      • publisher optional - string

        The publisher ID.

  • properties required
      • additionalCapabilities optional
          • hibernationEnabled optional - boolean

            The flag that enables or disables hibernation capability on the VM.

          • ultraSSDEnabled optional - boolean

            The flag that enables or disables a capability to have one or more managed data disks with UltraSSD_LRS storage account type on the VM or VMSS. Managed disks with storage account type UltraSSD_LRS can be added to a virtual machine or virtual machine scale set only if this property is enabled.

      • automaticRepairsPolicy optional
          • enabled optional - boolean

            Specifies whether automatic repairs should be enabled on the virtual machine scale set. The default value is false.

          • gracePeriod optional - string

            The amount of time for which automatic repairs are suspended due to a state change on VM. The grace time starts after the state change has completed. This helps avoid premature or accidental repairs. The time duration should be specified in ISO 8601 format. The minimum allowed grace period is 30 minutes (PT30M), which is also the default value. The maximum allowed grace period is 90 minutes (PT90M).

      • doNotRunExtensionsOnOverprovisionedVMs optional - boolean

        When Overprovision is enabled, extensions are launched only on the requested number of VMs which are finally kept. This property will hence ensure that the extensions do not run on the extra overprovisioned VMs.

      • hostGroup optional
          • id optional - string

            Resource Id

      • orchestrationMode optional - string

        Specifies the orchestration mode for the virtual machine scale set.

      • overprovision optional - boolean

        Specifies whether the Virtual Machine Scale Set should be overprovisioned.

      • platformFaultDomainCount optional - integer

        Fault Domain count for each placement group.

      • proximityPlacementGroup optional
          • id optional - string

            Resource Id

      • scaleInPolicy optional
          • forceDeletion optional - boolean

            This property allows you to specify if virtual machines chosen for removal have to be force deleted when a virtual machine scale set is being scaled-in.(Feature in Preview)

          • rules optional - array

            The rules to be followed when scaling-in a virtual machine scale set. Possible values are: Default When a virtual machine scale set is scaled in, the scale set will first be balanced across zones if it is a zonal scale set. Then, it will be balanced across Fault Domains as far as possible. Within each Fault Domain, the virtual machines chosen for removal will be the newest ones that are not protected from scale-in. OldestVM When a virtual machine scale set is being scaled-in, the oldest virtual machines that are not protected from scale-in will be chosen for removal. For zonal virtual machine scale sets, the scale set will first be balanced across zones. Within each zone, the oldest virtual machines that are not protected will be chosen for removal. NewestVM When a virtual machine scale set is being scaled-in, the newest virtual machines that are not protected from scale-in will be chosen for removal. For zonal virtual machine scale sets, the scale set will first be balanced across zones. Within each zone, the newest virtual machines that are not protected will be chosen for removal.

      • singlePlacementGroup optional - boolean

        When true this limits the scale set to a single placement group, of max size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to false. However, if singlePlacementGroup is false, it may not be modified to true.

      • spotRestorePolicy optional
          • enabled optional - boolean

            Enables the Spot-Try-Restore feature where evicted VMSS SPOT instances will be tried to be restored opportunistically based on capacity availability and pricing constraints

          • restoreTimeout optional - string

            Timeout value expressed as an ISO 8601 time duration after which the platform will not try to restore the VMSS SPOT instances

      • upgradePolicy optional
          • automaticOSUpgradePolicy optional
              • disableAutomaticRollback optional - boolean

                Whether OS image rollback feature should be disabled. Default value is false.

              • enableAutomaticOSUpgrade optional - boolean

                Indicates whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer version of the OS image becomes available. Default value is false. If this is set to true for Windows based scale sets, enableAutomaticUpdates is automatically set to false and cannot be set to true.

          • mode optional - string

            Specifies the mode of an upgrade to virtual machines in the scale set. Possible values are: Manual - You control the application of updates to virtual machines in the scale set. You do this by using the manualUpgrade action. Automatic - All virtual machines in the scale set are automatically updated at the same time.

          • rollingUpgradePolicy optional
              • enableCrossZoneUpgrade optional - boolean

                Allow VMSS to ignore AZ boundaries when constructing upgrade batches. Take into consideration the Update Domain and maxBatchInstancePercent to determine the batch size.

              • maxBatchInstancePercent optional - integer

                The maximum percent of total virtual machine instances that will be upgraded simultaneously by the rolling upgrade in one batch. As this is a maximum, unhealthy instances in previous or future batches can cause the percentage of instances in a batch to decrease to ensure higher reliability. The default value for this parameter is 20%.

              • maxUnhealthyInstancePercent optional - integer

                The maximum percentage of the total virtual machine instances in the scale set that can be simultaneously unhealthy, either as a result of being upgraded, or by being found in an unhealthy state by the virtual machine health checks before the rolling upgrade aborts. This constraint will be checked prior to starting any batch. The default value for this parameter is 20%.

              • maxUnhealthyUpgradedInstancePercent optional - integer

                The maximum percentage of upgraded virtual machine instances that can be found to be in an unhealthy state. This check will happen after each batch is upgraded. If this percentage is ever exceeded, the rolling update aborts. The default value for this parameter is 20%.

              • pauseTimeBetweenBatches optional - string

                The wait time between completing the update for all virtual machines in one batch and starting the next batch. The time duration should be specified in ISO 8601 format. The default value is 0 seconds (PT0S).

              • prioritizeUnhealthyInstances optional - boolean

                Upgrade all unhealthy instances in a scale set before any healthy instances.

      • virtualMachineProfile optional
          • applicationProfile optional
              • galleryApplications optional array
                  • configurationReference optional - string

                    Optional, Specifies the uri to an azure blob that will replace the default configuration for the package if provided

                  • order optional - integer

                    Optional, Specifies the order in which the packages have to be installed

                  • packageReferenceId required - string

                    Specifies the GalleryApplicationVersion resource id on the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}

                  • tags optional - string

                    Optional, Specifies a passthrough value for more generic context.

          • billingProfile optional
              • maxPrice optional - number

                Specifies the maximum price you are willing to pay for a Azure Spot VM/VMSS. This price is in US Dollars. This price will be compared with the current Azure Spot price for the VM size. Also, the prices are compared at the time of create/update of Azure Spot VM/VMSS and the operation will only succeed if the maxPrice is greater than the current Azure Spot price. The maxPrice will also be used for evicting a Azure Spot VM/VMSS if the current Azure Spot price goes beyond the maxPrice after creation of VM/VMSS. Possible values are: - Any decimal value greater than zero. Example: 0.01538 -1 – indicates default price to be up-to on-demand. You can set the maxPrice to -1 to indicate that the Azure Spot VM/VMSS should not be evicted for price reasons. Also, the default max price is -1 if it is not provided by you. Minimum api-version: 2019-03-01.

          • capacityReservation optional
              • capacityReservationGroup optional
                  • id optional - string

                    Resource Id

          • diagnosticsProfile optional
              • bootDiagnostics optional
                  • enabled optional - boolean

                    Whether boot diagnostics should be enabled on the Virtual Machine.

                  • storageUri optional - string

                    Uri of the storage account to use for placing the console output and screenshot. If storageUri is not specified while enabling boot diagnostics, managed storage will be used.

          • evictionPolicy optional - string

            Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview.

          • extensionProfile optional
              • extensions optional array
                  • name optional - string

                    The name of the extension.

              • extensionsTimeBudget optional - string

                Specifies the time alloted for all extensions to start. The time duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default value is 90 minutes (PT1H30M). Minimum api-version: 2020-06-01

          • licenseType optional - string

            Specifies that the image or disk that is being used was licensed on-premises. Possible values for Windows Server operating system are: Windows_Client Windows_Server Possible values for Linux Server operating system are: RHEL_BYOS (for RHEL) SLES_BYOS (for SUSE) For more information, see Azure Hybrid Use Benefit for Windows Server Azure Hybrid Use Benefit for Linux Server Minimum api-version: 2015-06-15

          • networkProfile optional
              • healthProbe optional
                  • id optional - string

                    The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/...

              • networkApiVersion optional - string

                specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations for Virtual Machine Scale Set with orchestration mode 'Flexible'.

              • networkInterfaceConfigurations optional array
                  • id optional - string

                    Resource Id

                  • name required - string

                    The network configuration name.

                  • properties optional
                      • deleteOption optional - string

                        Specify what happens to the network interface when the VM is deleted.

                      • dnsSettings optional
                          • dnsServers optional - array

                            List of DNS servers IP addresses

                      • enableAcceleratedNetworking optional - boolean

                        Specifies whether the network interface is accelerated networking-enabled.

                      • enableFpga optional - boolean

                        Specifies whether the network interface is FPGA networking-enabled.

                      • enableIPForwarding optional - boolean

                        Whether IP forwarding enabled on this NIC.

                      • ipConfigurations required array
                          • id optional - string

                            Resource Id

                          • name required - string

                            The IP configuration name.

                          • properties optional
                              • applicationGatewayBackendAddressPools optional array
                                  • id optional - string

                                    Resource Id

                              • applicationSecurityGroups optional array
                                  • id optional - string

                                    Resource Id

                              • loadBalancerBackendAddressPools optional array
                                  • id optional - string

                                    Resource Id

                              • loadBalancerInboundNatPools optional array
                                  • id optional - string

                                    Resource Id

                              • primary optional - boolean

                                Specifies the primary network interface in case the virtual machine has more than 1 network interface.

                              • privateIPAddressVersion optional - string

                                Available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'.

                              • publicIPAddressConfiguration optional
                                  • name required - string

                                    The publicIP address configuration name.

                                  • properties optional
                                      • deleteOption optional - string

                                        Specify what happens to the public IP when the VM is deleted.

                                      • dnsSettings optional
                                          • domainNameLabel required - string

                                            The Domain name label.The concatenation of the domain name label and vm index will be the domain name labels of the PublicIPAddress resources that will be created

                                      • idleTimeoutInMinutes optional - integer

                                        The idle timeout of the public IP address.

                                      • ipTags optional array
                                          • ipTagType optional - string

                                            IP tag type. Example: FirstPartyUsage.

                                          • tag optional - string

                                            IP tag associated with the public IP. Example: SQL, Storage etc.

                                      • publicIPAddressVersion optional - string

                                        Available from Api-Version 2019-07-01 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'.

                                      • publicIPPrefix optional
                                          • id optional - string

                                            Resource Id

                                  • sku optional
                                      • name optional - string

                                        Specify public IP sku name.

                                      • tier optional - string

                                        Specify public IP sku tier.

                              • subnet optional
                                  • id optional - string

                                    The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/...

                      • networkSecurityGroup optional
                          • id optional - string

                            Resource Id

                      • primary optional - boolean

                        Specifies the primary network interface in case the virtual machine has more than 1 network interface.

          • osProfile optional
              • adminPassword optional - string

                Specifies the password of the administrator account. Minimum-length (Windows): 8 characters Minimum-length (Linux): 6 characters Max-length (Windows): 123 characters Max-length (Linux): 72 characters Complexity requirements: 3 out of 4 conditions below need to be fulfilled Has lower characters Has upper characters Has a digit Has a special character (Regex match [\W_]) Disallowed values: "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" For resetting the password, see How to reset the Remote Desktop service or its login password in a Windows VM For resetting root password, see Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension

              • adminUsername optional - string

                Specifies the name of the administrator account. Windows-only restriction: Cannot end in "." Disallowed values: "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". Minimum-length (Linux): 1 character Max-length (Linux): 64 characters Max-length (Windows): 20 characters

              • computerNamePrefix optional - string

                Specifies the computer name prefix for all of the virtual machines in the scale set. Computer name prefixes must be 1 to 15 characters long.

              • customData optional - string

                Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. For using cloud-init for your VM, see Using cloud-init to customize a Linux VM during creation

              • linuxConfiguration optional
                  • disablePasswordAuthentication optional - boolean

                    Specifies whether password authentication should be disabled.

                  • patchSettings optional
                      • assessmentMode optional - string

                        Specifies the mode of VM Guest Patch Assessment for the IaaS virtual machine. Possible values are: ImageDefault - You control the timing of patch assessments on a virtual machine. AutomaticByPlatform - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true.

                      • patchMode optional - string

                        Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale set with OrchestrationMode as Flexible. Possible values are: ImageDefault - The virtual machine's default patching configuration is used. AutomaticByPlatform - The virtual machine will be automatically updated by the platform. The property provisionVMAgent must be true.

                  • provisionVMAgent optional - boolean

                    Indicates whether virtual machine agent should be provisioned on the virtual machine. When this property is not specified in the request body, default behavior is to set it to true. This will ensure that VM Agent is installed on the VM so that extensions can be added to the VM later.

                  • ssh optional
                      • publicKeys optional array
                          • keyData optional - string

                            SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed).

                          • path optional - string

                            Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys

              • secrets optional array
                  • sourceVault optional
                      • id optional - string

                        Resource Id

                  • vaultCertificates optional array
                      • certificateStore optional - string

                        For Windows VMs, specifies the certificate store on the Virtual Machine to which the certificate should be added. The specified certificate store is implicitly in the LocalMachine account. For Linux VMs, the certificate file is placed under the /var/lib/waagent directory, with the file name <UppercaseThumbprint>.crt for the X509 certificate file and <UppercaseThumbprint>.prv for private key. Both of these files are .pem formatted.

                      • certificateUrl optional - string

                        This is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a secret to the Key Vault, see Add a key or secret to the key vault. In this case, your certificate needs to be It is the Base64 encoding of the following JSON Object which is encoded in UTF-8: { "data":"<Base64-encoded-certificate>", "dataType":"pfx", "password":"<pfx-file-password>" } To install certificates on a virtual machine it is recommended to use the Azure Key Vault virtual machine extension for Linux or the Azure Key Vault virtual machine extension for Windows.

              • windowsConfiguration optional
                  • additionalUnattendContent optional array
                      • componentName optional - string

                        The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup.

                      • content optional - string

                        Specifies the XML formatted content that is added to the unattend.xml file for the specified path and component. The XML must be less than 4KB and must include the root element for the setting or feature that is being inserted.

                      • passName optional - string

                        The pass name. Currently, the only allowable value is OobeSystem.

                      • settingName optional - string

                        Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon.

                  • enableAutomaticUpdates optional - boolean

                    Indicates whether Automatic Updates is enabled for the Windows virtual machine. Default value is true. For virtual machine scale sets, this property can be updated and updates will take effect on OS reprovisioning.

                  • patchSettings optional
                      • assessmentMode optional - string

                        Specifies the mode of VM Guest patch assessment for the IaaS virtual machine. Possible values are: ImageDefault - You control the timing of patch assessments on a virtual machine. AutomaticByPlatform - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true.

                      • enableHotpatching optional - boolean

                        Enables customers to patch their Azure VMs without requiring a reboot. For enableHotpatching, the 'provisionVMAgent' must be set to true and 'patchMode' must be set to 'AutomaticByPlatform'.

                      • patchMode optional - string

                        Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale set with OrchestrationMode as Flexible. Possible values are: Manual - You control the application of patches to a virtual machine. You do this by applying patches manually inside the VM. In this mode, automatic updates are disabled; the property WindowsConfiguration.enableAutomaticUpdates must be false AutomaticByOS - The virtual machine will automatically be updated by the OS. The property WindowsConfiguration.enableAutomaticUpdates must be true. AutomaticByPlatform - the virtual machine will automatically updated by the platform. The properties provisionVMAgent and WindowsConfiguration.enableAutomaticUpdates must be true.

                  • provisionVMAgent optional - boolean

                    Indicates whether virtual machine agent should be provisioned on the virtual machine. When this property is not specified in the request body, default behavior is to set it to true. This will ensure that VM Agent is installed on the VM so that extensions can be added to the VM later.

                  • timeZone optional - string

                    Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". Possible values can be TimeZoneInfo.Id value from time zones returned by TimeZoneInfo.GetSystemTimeZones.

                  • winRM optional
                      • listeners optional array
                          • certificateUrl optional - string

                            This is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a secret to the Key Vault, see Add a key or secret to the key vault. In this case, your certificate needs to be It is the Base64 encoding of the following JSON Object which is encoded in UTF-8: { "data":"<Base64-encoded-certificate>", "dataType":"pfx", "password":"<pfx-file-password>" } To install certificates on a virtual machine it is recommended to use the Azure Key Vault virtual machine extension for Linux or the Azure Key Vault virtual machine extension for Windows.

                          • protocol optional - string

                            Specifies the protocol of WinRM listener. Possible values are: http https.

          • priority optional - string

            Specifies the priority for the virtual machines in the scale set. Minimum api-version: 2017-10-30-preview.

          • scheduledEventsProfile optional
              • terminateNotificationProfile optional
                  • enable optional - boolean

                    Specifies whether the Terminate Scheduled event is enabled or disabled.

                  • notBeforeTimeout optional - string

                    Configurable length of time a Virtual Machine being deleted will have to potentially approve the Terminate Scheduled Event before the event is auto approved (timed out). The configuration must be specified in ISO 8601 format, the default value is 5 minutes (PT5M)

          • securityProfile optional
              • encryptionAtHost optional - boolean

                This property can be used by user in the request to enable or disable the Host Encryption for the virtual machine or virtual machine scale set. This will enable the encryption for all the disks including Resource/Temp disk at host itself. Default: The Encryption at host will be disabled unless this property is set to true for the resource.

              • securityType optional - string

                Specifies the SecurityType of the virtual machine. It is set as TrustedLaunch to enable UefiSettings. Default: UefiSettings will not be enabled unless this property is set as TrustedLaunch.

              • uefiSettings optional
                  • secureBootEnabled optional - boolean

                    Specifies whether secure boot should be enabled on the virtual machine. Minimum api-version: 2020-12-01

                  • vTpmEnabled optional - boolean

                    Specifies whether vTPM should be enabled on the virtual machine. Minimum api-version: 2020-12-01

          • storageProfile optional
              • dataDisks optional array
                  • caching optional - string

                    Specifies the caching requirements. Possible values are: None ReadOnly ReadWrite Default: None for Standard storage. ReadOnly for Premium storage.

                  • createOption required - string

                    The create option.

                  • diskIOPSReadWrite optional - integer

                    Specifies the Read-Write IOPS for the managed disk. Should be used only when StorageAccountType is UltraSSD_LRS. If not specified, a default value would be assigned based on diskSizeGB.

                  • diskMBpsReadWrite optional - integer

                    Specifies the bandwidth in MB per second for the managed disk. Should be used only when StorageAccountType is UltraSSD_LRS. If not specified, a default value would be assigned based on diskSizeGB.

                  • diskSizeGB optional - integer

                    Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image. This value cannot be larger than 1023 GB

                  • lun required - integer

                    Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM.

                  • managedDisk optional
                      • diskEncryptionSet optional
                          • id optional - string

                            Resource Id

                      • storageAccountType optional - string

                        Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk.

                  • name optional - string

                    The disk name.

                  • writeAcceleratorEnabled optional - boolean

                    Specifies whether writeAccelerator should be enabled or disabled on the disk.

              • imageReference optional
                  • id optional - string

                    Resource Id

                  • offer optional - string

                    Specifies the offer of the platform image or marketplace image used to create the virtual machine.

                  • publisher optional - string

                    The image publisher.

                  • sharedGalleryImageId optional - string

                    Specified the shared gallery image unique id for vm deployment. This can be fetched from shared gallery image GET call.

                  • sku optional - string

                    The image SKU.

                  • version optional - string

                    Specifies the version of the platform image or marketplace image used to create the virtual machine. The allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. Specify 'latest' to use the latest version of an image available at deploy time. Even if you use 'latest', the VM image will not automatically update after deploy time even if a new version becomes available.

              • osDisk optional
                  • caching optional - string

                    Specifies the caching requirements. Possible values are: None ReadOnly ReadWrite Default: None for Standard storage. ReadOnly for Premium storage.

                  • createOption required - string

                    Specifies how the virtual machines in the scale set should be created. The only allowed value is: FromImage \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described.

                  • diffDiskSettings optional
                  • diskSizeGB optional - integer

                    Specifies the size of the operating system disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image. This value cannot be larger than 1023 GB

                  • image optional
                      • uri optional - string

                        Specifies the virtual hard disk's uri.

                  • managedDisk optional
                      • diskEncryptionSet optional
                          • id optional - string

                            Resource Id

                      • storageAccountType optional - string

                        Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk.

                  • name optional - string

                    The disk name.

                  • osType optional - string

                    This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. Possible values are: Windows Linux.

                  • vhdContainers optional - array

                    Specifies the container urls that are used to store operating system disks for the scale set.

                  • writeAcceleratorEnabled optional - boolean

                    Specifies whether writeAccelerator should be enabled or disabled on the disk.

          • userData optional - string

            UserData for the virtual machines in the scale set, which must be base-64 encoded. Customer should not pass any secrets in here. Minimum api-version: 2021-03-01

      • zoneBalance optional - boolean

        Whether to force strictly even Virtual Machine distribution cross x-zones in case there is zone outage. zoneBalance property can only be set if the zones property of the scale set contains more than one zone. If there are no zones or only one zone specified, then zoneBalance property should not be set.

  • sku optional
      • capacity optional - integer

        Specifies the number of virtual machines in the scale set.

      • name optional - string

        The sku name.

      • tier optional - string

        Specifies the tier of virtual machines in a scale set. Possible Values: Standard Basic

  • tags optional - string

    Resource tags

  • type required - string
  • zones optional - array

    The virtual machine scale set zones. NOTE: Availability zones can only be set when you create the scale set

Frequently asked questions

What is Azure Compute Virtual Machine Scale Set?

Azure Compute Virtual Machine Scale Set is a resource for Compute of Microsoft Azure. Settings can be wrote in Terraform.

Where can I find the example code for the Azure Compute Virtual Machine Scale Set?

For Terraform, the prabhat2346/terraform_k8s, dhinesh609/technical-challenge and gilyas/infracost source code examples are useful. See the Terraform Example section for further details.

For Azure Resource Manager, the Jyotsna-Anand/azure-arm-templates, Jyotsna-Anand/azure-arm-templates and timwebster9/azure-policy source code examples are useful. See the Azure Resource Manager Example section for further details.