title | description | ms.date | monikerRange |
---|---|---|---|
AzureVmssDeployment@0 - Azure VM scale set deployment v0 task |
Deploy a virtual machine scale set image. |
10/10/2024 |
<=azure-pipelines |
:::moniker range="<=azure-pipelines"
This task deploys a Virtual Machine scale set image.
:::moniker-end
:::moniker range=">=azure-pipelines-2019.1"
# Azure VM scale set deployment v0
# Deploy a virtual machine scale set image.
- task: AzureVmssDeployment@0
inputs:
# Azure Details
azureSubscription: # string. Alias: ConnectedServiceName. Required. Azure subscription.
action: 'Update image' # 'Update image' | 'Configure application startup'. Required. Action. Default: Update image.
vmssName: # string. Required. Virtual Machine scale set name.
vmssOsType: # 'Windows' | 'Linux'. Required. OS type.
# Image Details
#imageUrl: # string. Required when action = Update image || action = UpdateImage. Image URL.
# Configure start-up
#customScriptsDirectory: # string. Optional. Use when action = Configure application startup || action = Update image || action = UpdateImage. Custom script directory.
#customScript: # string. Optional. Use when action = Configure application startup || action = Update image || action = UpdateImage. Command.
#customScriptArguments: # string. Optional. Use when action = Configure application startup || action = Update image || action = UpdateImage. Arguments.
#customScriptsStorageAccount: # string. Optional. Use when action = Configure application startup || action = Update image || action = UpdateImage. Azure storage account where custom scripts will be uploaded.
# Advanced
#skipArchivingCustomScripts: false # boolean. Skip Archiving custom scripts. Default: false.
:::moniker-end
:::moniker range="=azure-pipelines-2019"
# Azure VM scale set Deployment v0
# Deploy Virtual Machine scale set image.
- task: AzureVmssDeployment@0
inputs:
# Azure Details
azureSubscription: # string. Alias: ConnectedServiceName. Required. Azure subscription.
action: 'Update image' # 'Update image' | 'Configure application startup'. Required. Action. Default: Update image.
vmssName: # string. Required. Virtual Machine scale set name.
vmssOsType: # 'Windows' | 'Linux'. Required. OS type.
# Image Details
#imageUrl: # string. Required when action = Update image || action = UpdateImage. Image URL.
# Configure start-up
#customScriptsDirectory: # string. Optional. Use when action = Configure application startup || action = Update image || action = UpdateImage. Custom script directory.
#customScript: # string. Optional. Use when action = Configure application startup || action = Update image || action = UpdateImage. Command.
#customScriptArguments: # string. Optional. Use when action = Configure application startup || action = Update image || action = UpdateImage. Arguments.
#customScriptsStorageAccount: # string. Optional. Use when action = Configure application startup || action = Update image || action = UpdateImage. Azure storage account where custom scripts will be uploaded.
# Advanced
#skipArchivingCustomScripts: false # boolean. Skip Archiving custom scripts. Default: false.
:::moniker-end
:::moniker range="<=azure-pipelines"
azureSubscription
- Azure subscription
Input alias: ConnectedServiceName
. string
. Required.
Specifies the Azure Resource Manager subscription for the scale set.
:::moniker-end
:::moniker range="<=azure-pipelines"
action
- Action
string
. Required. Allowed values: Update image
(Update VM Scale set by using an image), Configure application startup
(Run Custom Script VM extension on VM scale set). Default value: Update image
.
Updates a VM scale set by the chosen method, using a VHD image and/or by running deployment/install scripts using the Custom Script VM Extension.
The VHD image approach is better for scaling quickly and doing rollback. When a VM scale set is created by using a custom image, it can be updated by a VHD 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 is useful for post deployment configuration, software installation, or any other configuration/management task. The Custom Script VM Extension approach can be used for a VM scale set created by using either a custom image or a platform/gallery image.
:::moniker-end
:::moniker range="<=azure-pipelines"
vmssName
- Virtual Machine scale set name
string
. Required.
Specifies the name of the VM scale setting to update. Use either a VHD image or a Custom Script VM Extension.
:::moniker-end
:::moniker range="<=azure-pipelines"
vmssOsType
- OS type
string
. Required. Allowed values: Windows
, Linux
.
Specifies the operating system type of the VM scale set.
:::moniker-end
:::moniker range=">=azure-pipelines-2019"
imageUrl
- Image URL
string
. Required when action = Update image || action = UpdateImage
.
Specifies the URL of the VHD image. If it's an Azure storage blob URL, the storage account location is the same as the scale set location.
:::moniker-end
:::moniker range="<=azure-pipelines"
customScriptsDirectory
- Custom script directory
string
. Optional. Use when action = Configure application startup || action = Update image || action = UpdateImage
.
Optional. The path to the directory containing the custom script(s) that are run by using the 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 environment variable which the application uses, like database connection strings.
:::moniker-end
:::moniker range="<=azure-pipelines"
customScript
- Command
string
. Optional. Use when action = Configure application startup || action = Update image || action = UpdateImage
.
Optional. The script that is run by using the Custom Script VM Extension. This script can invoke other scripts in the directory and is invoked with the arguments passed below.
In conjunction with such arguments, this script can be used to execute commands.
For example:
Update-DatabaseConnectionStrings.ps1 -clusterType dev -user $(dbUser) -password $(dbUserPwd)
updates the connection string inweb.config
of the web application.install-secrets.sh --key-vault-type prod -key serviceprincipalkey
creates an encrypted file containing a service principal key.
:::moniker-end
:::moniker range="<=azure-pipelines"
customScriptArguments
- Arguments
string
. Optional. Use when action = Configure application startup || action = Update image || action = UpdateImage
.
Optional. The custom script will be invoked with arguments passed. Build/release variables can be used, which makes it easy to use secrets.
:::moniker-end
:::moniker range="<=azure-pipelines"
customScriptsStorageAccount
- Azure storage account where custom scripts will be uploaded
string
. Optional. Use when action = Configure application startup || action = Update image || action = UpdateImage
.
Optional. The Custom Script Extension downloads and executes the provided scripts on each virtual machine in the VM scale set. These scripts will be stored in the pre-existing ARM storage account specified here.
:::moniker-end
:::moniker range="<=azure-pipelines"
skipArchivingCustomScripts
- Skip Archiving custom scripts
boolean
. Default value: false
.
Optional. By default, this task creates a compressed archive of the directory containing the 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.
:::moniker-end
All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.
:::moniker range="<=azure-pipelines"
None.
:::moniker-end
Use this task to deploy a Virtual Machine scale set image.
Scale sets have an upgrade policy that determine how VMs are brought up-to-date with the latest scale set model, and if the upgrade policy is set to manual you must manually upgrade each VM. For more information, see How to bring VMs up-to-date with the latest scale set model. You can change the update policy or manually upgrade each VM. For example, to upgrade the policy to Automatic
, use the following Az CLI command:
az vmss update --set upgradePolicy.mode=Automatic -g <resource group name> -n <vmss name>
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'
:::moniker range="=azure-pipelines"
Requirement | Description |
---|---|
Pipeline types | YAML, Classic build, Classic release |
Runs on | Agent, DeploymentGroup |
Demands | None |
Capabilities | This task does not satisfy any demands for subsequent tasks in the job. |
Command restrictions | Any |
Settable variables | Any |
Agent version | 2.209.0 or greater |
Task category | Deploy |
:::moniker-end
:::moniker range="<=azure-pipelines-2022.2"
Requirement | Description |
---|---|
Pipeline types | YAML, Classic build, Classic release |
Runs on | Agent, DeploymentGroup |
Demands | None |
Capabilities | This task does not satisfy any demands for subsequent tasks in the job. |
Command restrictions | Any |
Settable variables | Any |
Agent version | 2.0.0 or greater |
Task category | Deploy |
:::moniker-end