Muokkaa

Jaa


AzureFileCopy@2 - Azure file copy v2 task

Copy files to Azure Blob Storage or virtual machines.

This task is deprecated as this version of the AzureFileCopy task uses a retired version of AzCopy. Use the latest version of the AzureFileCopy task. See AzCopy Migration Guide for v8 to v10.

Copy files to Azure Blob Storage or virtual machines.

Syntax

# Azure file copy v2
# Copy files to Azure Blob Storage or virtual machines.
- task: AzureFileCopy@2
  inputs:
    SourcePath: # string. Required. Source. 
    #azureConnectionType: 'ConnectedServiceNameARM' # 'ConnectedServiceName' | 'ConnectedServiceNameARM'. Alias: ConnectedServiceNameSelector. Azure Connection Type. Default: ConnectedServiceNameARM.
    #azureClassicSubscription: # string. Alias: ConnectedServiceName. Required when ConnectedServiceNameSelector = ConnectedServiceName. Azure Classic Subscription. 
    azureSubscription: # string. Alias: ConnectedServiceNameARM. Required when ConnectedServiceNameSelector = ConnectedServiceNameARM. Azure Subscription. 
    Destination: # 'AzureBlob' | 'AzureVMs'. Required. Destination Type. 
    #classicStorage: # string. Alias: StorageAccount. Required when ConnectedServiceNameSelector = ConnectedServiceName. Classic Storage Account. 
    storage: # string. Alias: StorageAccountRM. Required when ConnectedServiceNameSelector = ConnectedServiceNameARM. RM Storage Account. 
    #ContainerName: # string. Required when Destination = AzureBlob. Container Name. 
    #BlobPrefix: # string. Optional. Use when Destination = AzureBlob. Blob Prefix. 
    #cloudService: # string. Alias: EnvironmentName. Required when ConnectedServiceNameSelector = ConnectedServiceName && Destination = AzureVMs. Cloud Service. 
    #resourceGroup: # string. Alias: EnvironmentNameRM. Required when ConnectedServiceNameSelector = ConnectedServiceNameARM && Destination = AzureVMs. Resource Group. 
    #ResourceFilteringMethod: 'machineNames' # 'machineNames' | 'tags'. Optional. Use when Destination = AzureVMs. Select Machines By. Default: machineNames.
    #MachineNames: # string. Optional. Use when Destination = AzureVMs. Filter Criteria. 
    #vmsAdminUserName: # string. Required when Destination = AzureVMs. Admin Login. 
    #vmsAdminPassword: # string. Required when Destination = AzureVMs. Password. 
    #TargetPath: # string. Required when Destination = AzureVMs. Destination Folder. 
    #AdditionalArgumentsForBlobCopy: # string. Optional Arguments (for uploading files to blob). 
    #AdditionalArgumentsForVMCopy: # string. Optional. Use when Destination = AzureVMs. Optional Arguments (for downloading files to VM). 
    #enableCopyPrerequisites: false # boolean. Optional. Use when ConnectedServiceNameSelector = ConnectedServiceNameARM && Destination = AzureVMs. Enable Copy Prerequisites. Default: false.
    #CopyFilesInParallel: true # boolean. Optional. Use when Destination = AzureVMs. Copy in Parallel. Default: true.
    #CleanTargetBeforeCopy: false # boolean. Optional. Use when Destination = AzureVMs. Clean Target. Default: false.
    #skipCACheck: true # boolean. Optional. Use when Destination = AzureVMs. Test Certificate. Default: true.
  # Output
    #outputStorageUri: # string. Storage Container URI. 
    #outputStorageContainerSasToken: # string. Storage Container SAS Token.
# Azure File Copy v2
# Copy files to Azure blob or VM(s).
- task: AzureFileCopy@2
  inputs:
    SourcePath: # string. Required. Source. 
    #azureConnectionType: 'ConnectedServiceNameARM' # 'ConnectedServiceName' | 'ConnectedServiceNameARM'. Alias: ConnectedServiceNameSelector. Azure Connection Type. Default: ConnectedServiceNameARM.
    #azureClassicSubscription: # string. Alias: ConnectedServiceName. Required when ConnectedServiceNameSelector = ConnectedServiceName. Azure Classic Subscription. 
    azureSubscription: # string. Alias: ConnectedServiceNameARM. Required when ConnectedServiceNameSelector = ConnectedServiceNameARM. Azure Subscription. 
    Destination: # 'AzureBlob' | 'AzureVMs'. Required. Destination Type. 
    #classicStorage: # string. Alias: StorageAccount. Required when ConnectedServiceNameSelector = ConnectedServiceName. Classic Storage Account. 
    storage: # string. Alias: StorageAccountRM. Required when ConnectedServiceNameSelector = ConnectedServiceNameARM. RM Storage Account. 
    #ContainerName: # string. Required when Destination = AzureBlob. Container Name. 
    #BlobPrefix: # string. Optional. Use when Destination = AzureBlob. Blob Prefix. 
    #cloudService: # string. Alias: EnvironmentName. Required when ConnectedServiceNameSelector = ConnectedServiceName && Destination = AzureVMs. Cloud Service. 
    #resourceGroup: # string. Alias: EnvironmentNameRM. Required when ConnectedServiceNameSelector = ConnectedServiceNameARM && Destination = AzureVMs. Resource Group. 
    #ResourceFilteringMethod: 'machineNames' # 'machineNames' | 'tags'. Optional. Use when Destination = AzureVMs. Select Machines By. Default: machineNames.
    #MachineNames: # string. Optional. Use when Destination = AzureVMs. Filter Criteria. 
    #vmsAdminUserName: # string. Required when Destination = AzureVMs. Admin Login. 
    #vmsAdminPassword: # string. Required when Destination = AzureVMs. Password. 
    #TargetPath: # string. Required when Destination = AzureVMs. Destination Folder. 
    #AdditionalArgumentsForBlobCopy: # string. Optional Arguments (for uploading files to blob). 
    #AdditionalArgumentsForVMCopy: # string. Optional. Use when Destination = AzureVMs. Optional Arguments (for downloading files to VM). 
    #enableCopyPrerequisites: false # boolean. Optional. Use when ConnectedServiceNameSelector = ConnectedServiceNameARM && Destination = AzureVMs. Enable Copy Prerequisites. Default: false.
    #CopyFilesInParallel: true # boolean. Optional. Use when Destination = AzureVMs. Copy in Parallel. Default: true.
    #CleanTargetBeforeCopy: false # boolean. Optional. Use when Destination = AzureVMs. Clean Target. Default: false.
    #skipCACheck: true # boolean. Optional. Use when Destination = AzureVMs. Test Certificate. Default: true.
  # Output
    #outputStorageUri: # string. Storage Container URI. 
    #outputStorageContainerSasToken: # string. Storage Container SAS Token.

Inputs

SourcePath - Source
string. Required.

Specify the absolute path to the source folder, file on the local machine, or a UNC share. The specified value or expression should return either a single folder name or a file name.


azureConnectionType - Azure Connection Type
Input alias: ConnectedServiceNameSelector. string. Allowed values: ConnectedServiceName (Azure Classic), ConnectedServiceNameARM (Azure Resource Manager). Default value: ConnectedServiceNameARM.

Specify the Azure connection type.


azureClassicSubscription - Azure Classic Subscription
Input alias: ConnectedServiceName. string. Required when ConnectedServiceNameSelector = ConnectedServiceName.

Specify the target Azure Classic subscription.


azureSubscription - Azure Subscription
Input alias: ConnectedServiceNameARM. string. Required when ConnectedServiceNameSelector = ConnectedServiceNameARM.

Specify the target Azure Resource Manager subscription.


Destination - Destination Type
string. Required. Allowed values: AzureBlob (Azure Blob), AzureVMs (Azure VMs).

Specify the destination type to use for copying the files.


classicStorage - Classic Storage Account
Input alias: StorageAccount. string. Required when ConnectedServiceNameSelector = ConnectedServiceName.

Specify a pre-existing classic storage account. This is the storage account used as an intermediary for copying files to Azure VMs.


storage - RM Storage Account
Input alias: StorageAccountRM. string. Required when ConnectedServiceNameSelector = ConnectedServiceNameARM.

Specify a pre-existing ARM storage account. This is the storage account used as an intermediary for copying files to Azure VMs.


ContainerName - Container Name
string. Required when Destination = AzureBlob.

Specify the name of the container into which files are copied. If the specified container does not exist in the storage account, it will be created.

To create a virtual directory inside the container, use the Blob prefix input. For example, for target location https://myaccount.blob.core.windows.net/mycontainer/vd1/vd2/, specify the container name mycontainer and Blob prefix vd1/vd2.


BlobPrefix - Blob Prefix
string. Optional. Use when Destination = AzureBlob.

Specify a prefix that can be used to filter files.

Example: You can append a build number to filter the files from all Blobs with the same build number.

Example: If you specify a Blob prefix myvd1, a virtual directory is created inside the container. Files are copied from the source to https://myaccount.blob.core.windows.net/mycontainer/myvd1/.


cloudService - Cloud Service
Input alias: EnvironmentName. string. Required when ConnectedServiceNameSelector = ConnectedServiceName && Destination = AzureVMs.

Specify the name of the target Cloud Service.


resourceGroup - Resource Group
Input alias: EnvironmentNameRM. string. Required when ConnectedServiceNameSelector = ConnectedServiceNameARM && Destination = AzureVMs.

Specify the name of the target Resource Group.


ResourceFilteringMethod - Select Machines By
string. Optional. Use when Destination = AzureVMs. Allowed values: machineNames (Machine Names), tags. Default value: machineNames.

Specify the VM host name or tag that identifies a subset of VMs in a resource group. Tags are supported for resources created via the Azure Resource Manager only.


MachineNames - Filter Criteria
string. Optional. Use when Destination = AzureVMs.

Provide a list of Azure VM host names such as ffweb, ffdb, or tags such as Role:DB, Web, OS:Win8.1.

Note: Valid delimiters for tags include ,(comma), :(colon) and ;(semicolon). When providing multiple tags, the task will run in all the VMs that contains the specified tags. By default, the task runs in all the VMs.


vmsAdminUserName - Admin Login
string. Required when Destination = AzureVMs.

Provide the user name of the Azure VM administrator account.


vmsAdminPassword - Password
string. Required when Destination = AzureVMs.

Provide the password for the Azure VM administrator account.

Valid input includes variables defined in build or release pipelines such as $(passwordVariable). To secure a password, mark it as secret.


TargetPath - Destination Folder
string. Required when Destination = AzureVMs.

Specify the local path on the target VMs.

Valid input includes environment variables such as $env:windir\BudgetIT\Web.


AdditionalArgumentsForBlobCopy - Optional Arguments (for uploading files to blob)
string.

Provide additional arguments to AzCopy.exe that can be applied when uploading to Blobs such as /NC:10.

If no optional arguments are specified, the following arguments are added by default.

  • /Y
  • /SetContentType
  • /Z
  • /V
  • /S - Added when the container name is not $root.
  • /BlobType:page - Added when the specified storage account is a premium account.
  • /Pattern - Added when the source path is a file. Included with any other specified optional arguments.

AdditionalArgumentsForVMCopy - Optional Arguments (for downloading files to VM)
string. Optional. Use when Destination = AzureVMs.

Provide additional arguments to AzCopy.exe that can be applied when downloading to VMs such as /NC:10.

If no optional arguments are specified, the following are added by default.

  • /Y
  • /S
  • /Z
  • /V

enableCopyPrerequisites - Enable Copy Prerequisites
boolean. Optional. Use when ConnectedServiceNameSelector = ConnectedServiceNameARM && Destination = AzureVMs. Default value: false.

When enabled, uses a self-signed certificate to configure a Windows Remote Management (WinRM) listener on port 5986 instead of the HTTPS protocol. Required for performing copy operations on Azure VMs. If the target VMs use a load balancer, configure inbound NAT rules for the target port (5986). Applies only for ARM VMs.


CopyFilesInParallel - Copy in Parallel
boolean. Optional. Use when Destination = AzureVMs. Default value: true.

Accepting the default setting copies files in parallel to the target VMs.


CleanTargetBeforeCopy - Clean Target
boolean. Optional. Use when Destination = AzureVMs. Default value: false.

Setting this value to true cleans the destination folder before performing the copy action.


skipCACheck - Test Certificate
boolean. Optional. Use when Destination = AzureVMs. Default value: true.

The default value will not validate that the server certificate was signed by a trusted CA before connecting over HTTPS.


outputStorageUri - Storage Container URI
string.

Specify the name of the variable used for the storage container URI to which files were copied. Valid only when the selected destination is an Azure Blob.


outputStorageContainerSasToken - Storage Container SAS Token
string.

Specify the name of the variable used for the storage container SAS token that accesses the files that were copied. Valid only when the selected destination is an Azure Blob.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Remarks

What's new in Version 2.0: Using newer version of AzCopy.

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands Self-hosted agents must have capabilities that match the following demands to run jobs that use this task: azureps
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 1.103.0 or greater
Task category Deploy