Azure VM Scale Set Deployment task

Azure Pipelines

Use this task in a build or release pipeline to deploy a virtual machine scale set image.

YAML snippet

# Azure VM scale set deployment
# Deploy a virtual machine scale set image
- task: AzureVmssDeployment@0
  inputs:
    azureSubscription: 
    #action: 'Update image' # Options: update Image, configure Application Startup
    vmssName: 
    vmssOsType: # Options: windows, linux
    imageUrl: 
    #customScriptsDirectory: # Optional
    #customScript: # Optional
    #customScriptArguments: # Optional
    #customScriptsStorageAccount: # Optional
    #skipArchivingCustomScripts: # Optional

Arguments

ArgumentDescription
Azure subscription(Required) Select the Azure Resource Manager subscription for the scale set.
Action(Required) Choose between updating a VM scale set by using a VHD image and/or by running deployment/install scripts using Custom Script VM extension.
The VHD image approach is better for scaling quickly and doing rollback. The extension approach is useful for post deployment configuration, software installation, or any other configuration / management task.
You can use a VHD image to update a VM scale set only when it was created by using a custom image, the update will fail if the VM Scale set was created by using a platform/gallery image available in Azure.
The Custom script VM extension approach can be used for VM scale set created by using either custom image or platform/gallery image.
Virtual Machine scale set name(Required) Name of VM scale set which you want to update by using either a VHD image or by using Custom script VM extension.
OS type(Required) Select the operating system type of VM scale set.
Image url(Required) Specify the URL of VHD image. If it is an Azure storage blob url, the storage account location should be same as scale set location.
Custom script directory(Optional) Path to directory containing custom script(s) that will be run by using Custom Script VM extension. The extension approach is useful for post deployment configuration, application/software installation, or any other application configuration/management task. For example: the script can set a machine level stage variable which the application uses, like database connection string.
Command(Optional) The script that will be run by using Custom Script VM extension. This script can invoke other scripts in the directory. The script will be invoked with arguments passed below.
This script in conjugation with such arguments can be used to execute commands. For example:
1. Update-DatabaseConnectionStrings.ps1 -clusterType dev -user $(dbUser) -password $(dbUserPwd) will update connection string in web.config of web application.
2. install-secrets.sh --key-vault-type prod -key serviceprincipalkey will create an encrypted file containing service principal key.
Arguments(Optional) The custom script will be invoked with arguments passed. Build/Release variables can be used which makes it easy to use secrets.
Azure storage account where custom scripts will be uploaded(Optional) The Custom Script Extension downloads and executes scripts provided by you on each virtual machines in the VM scale set. These scripts will be stored in the storage account specified here. Specify a pre-existing ARM storage account.
Skip Archiving custom scripts(Optional) By default, this task creates a compressed archive of directory containing custom scripts. This improves performance and reliability while uploading to azure storage. If not selected, archiving will not be done and all files will be individually uploaded.
Control options

Open source

This task is open source on GitHub. Feedback and contributions are welcome.