Azure virtual machine scale set Deployment task
Azure DevOps Services
Use this task 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
| Argument | Description |
|---|---|
| Azure subscription | (Required) Select the Azure Resource Manager subscription for the scale set. |
| Action | (Required) Choose between updating a virtual machine 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 virtual machine scale set only when it was created by using a custom image, the update will fail if the virtual machine scale set was created by using a platform/gallery image available in Azure. The Custom script VM extension approach can be used for virtual machine scale set created by using either custom image or platform/gallery image. |
| Virtual machine scale set name | (Required) Name of virtual machine 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 virtual machine 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 virtual machine 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. |
Task control options
Troubleshooting
Error: 'Permission denied: Script is not executable'
This issue occurs if you try to run a custom script, but the script isn't executable.
To resolve the issue, first make sure that the customScript input doesn't have ./ or anything else before the script name 'test.sh':
customScript: 'test.sh'
Next, try adding a command line task before the virtual machine scale set task:
- task: CmdLine@2
inputs:
script: 'chmod 777 $(System.DefaultWorkingDirectory)/test.sh'
Open source
This task is open source on GitHub. Feedback and contributions are welcome.
Feedback
Issottometti u ara feedback għal