共用方式為


AzureFileCopy@2 - Azure 檔案複製 v2 工作

將檔案複製到Azure Blob 儲存體或虛擬機器。

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.

輸入

SourcePath -
string. 必要。

指定源資料夾、本機電腦上的檔案或 UNC 共用的絕對路徑。 指定的值或運算式應該傳回單一資料夾名稱或檔案名。


azureConnectionType - Azure 連線類型
輸入別名: ConnectedServiceNameSelectorstring. 允許的值: ConnectedServiceName (Azure 傳統) , ConnectedServiceNameARM (Azure Resource Manager) 。 預設值:ConnectedServiceNameARM

指定 Azure 連線類型。


azureClassicSubscription - Azure 傳統訂用帳戶
輸入別名: ConnectedServiceNamestring. 當 ConnectedServiceNameSelector = ConnectedServiceName 時為必要。

指定目標 Azure 傳統訂用帳戶。


azureSubscription - Azure 訂用帳戶
輸入別名: ConnectedServiceNameARMstring. 當 ConnectedServiceNameSelector = ConnectedServiceNameARM 時為必要。

指定目標 Azure Resource Manager訂用帳戶。


Destination - 目的地類型
string. 必要。 允許的值: AzureBlob (Azure Blob) , AzureVMs (Azure VM) 。

指定要用於複製檔案的目的地類型。


classicStorage - 傳統儲存體帳戶
輸入別名: StorageAccountstring. 當 ConnectedServiceNameSelector = ConnectedServiceName 時為必要。

指定預先存在的傳統儲存體帳戶。 這是用來作為將檔案複製到 Azure VM 的媒介儲存體帳戶。


storage - RM 儲存體帳戶
輸入別名: StorageAccountRMstring. 當 ConnectedServiceNameSelector = ConnectedServiceNameARM 時為必要。

指定預先存在的 ARM 儲存體帳戶。 這是用來作為將檔案複製到 Azure VM 的媒介儲存體帳戶。


ContainerName - 容器名稱
string. 當 Destination = AzureBlob 時為必要。

指定複製檔案的容器名稱。 如果指定的容器不存在於儲存體帳戶中,將會建立它。

若要在容器內建立虛擬目錄,請使用 Blob 前置詞輸入。 例如,針對目標位置 https://myaccount.blob.core.windows.net/mycontainer/vd1/vd2/ ,指定容器名稱和 mycontainer Blob 前置詞 vd1/vd2


BlobPrefix - Blob 前置詞
string. 選擇性。 使用 時 Destination = AzureBlob

指定可用來篩選檔案的前置詞。

範例:您可以附加組建編號,以篩選所有具有相同組建編號的 Blob 檔案。

範例:如果您指定 Blob 前置詞 myvd1 ,則會在容器內建立虛擬目錄。 檔案會從來源 https://myaccount.blob.core.windows.net/mycontainer/myvd1/ 複製到 。


cloudService - 雲端服務
輸入別名: EnvironmentNamestring. 當 ConnectedServiceNameSelector = ConnectedServiceName && Destination = AzureVMs 時為必要。

指定目標雲端服務的名稱。


resourceGroup - 資源群組
輸入別名: EnvironmentNameRMstring. 當 ConnectedServiceNameSelector = ConnectedServiceNameARM && Destination = AzureVMs 時為必要。

指定目標資源群組的名稱。


ResourceFilteringMethod - 選取機器依據
string. 選擇性。 使用 時 Destination = AzureVMs 。 允許的值: machineNames (電腦名稱稱) , tags 。 預設值:machineNames

指定 VM 主機名稱或標記,以識別資源群組中的 VM 子集。 僅支援透過 Azure Resource Manager建立的資源標記。


MachineNames - 篩選準則
string. 選擇性。 使用 時 Destination = AzureVMs

提供 Azure VM 主機名稱的清單,例如 ffwebffdb 或 標籤,例如 Role:DBWebOS:Win8.1

注意:標籤的有效分隔符號包括 、 (逗號) 、: (冒號) 和 ; (分號) 。 提供多個標記時,工作會在包含指定標籤的所有 VM 中執行。 根據預設,工作會在所有 VM 中執行。


vmsAdminUserName - 管理員登入
string. 當 Destination = AzureVMs 時為必要。

提供 Azure VM 系統管理員帳戶的使用者名稱。


vmsAdminPassword - 密碼
string. 當 Destination = AzureVMs 時為必要。

提供 Azure VM 系統管理員帳戶的密碼。

有效的輸入包括建置或發行管線中定義的變數,例如 $(passwordVariable) 。 若要保護密碼,請將密碼標示為 secret


TargetPath - 目的地資料夾
string. 當 Destination = AzureVMs 時為必要。

指定目標 VM 上的本機路徑。

有效的輸入包括環境變數,例如 $env:windir\BudgetIT\Web


AdditionalArgumentsForBlobCopy - 將檔案上傳至 Blob) 的選擇性引數 (
string.

提供上傳至 Blob 時可套用的其他引數 AzCopy.exe ,例如 /NC:10

如果未指定選擇性引數,預設會新增下列引數。

  • /Y
  • /SetContentType
  • /Z
  • /V
  • /S - 當容器名稱不是 $root 時加入 。
  • /BlobType:page - 當指定的儲存體帳戶是進階帳戶時新增。
  • /Pattern - 當來源路徑是檔案時新增。 隨附于任何其他指定的選擇性引數。

AdditionalArgumentsForVMCopy - 將檔案下載至 VM) 的選擇性引數 (
string. 選擇性。 使用 時 Destination = AzureVMs

提供下載至 VM 時可套用的其他引數 AzCopy.exe ,例如 /NC:10

如果未指定選擇性引數,預設會新增下列專案。

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

enableCopyPrerequisites - 啟用複製必要條件
boolean. 選擇性。 使用 時 ConnectedServiceNameSelector = ConnectedServiceNameARM && Destination = AzureVMs 。 預設值:false

啟用時,請使用自我簽署憑證,在埠 5986 上設定 Windows 遠端系統管理 (WinRM) 接聽程式,而不是 HTTPS 通訊協定。 在 Azure VM 上執行複製作業的必要專案。 如果目標 VM 使用負載平衡器,請針對目標埠設定輸入 NAT 規則, (5986) 。 僅適用于 ARM VM。


CopyFilesInParallel - 平行複製
boolean. 選擇性。 使用 時 Destination = AzureVMs 。 預設值:true

接受預設設定會將檔案平行複製到目標 VM。


CleanTargetBeforeCopy - 清除目標
boolean. 選擇性。 使用 時 Destination = AzureVMs 。 預設值:false

將此值設定為 true 先清除目的地資料夾,再執行複製動作。


skipCACheck - 測試憑證
boolean. 選擇性。 使用 時 Destination = AzureVMs 。 預設值:true

預設值不會驗證伺服器憑證是否已由受信任的 CA 簽署,然後再透過 HTTPS 進行連線。


outputStorageUri - 儲存體容器 URI
string.

指定用於複製檔案之儲存體容器 URI 的變數名稱。 只有在選取的目的地是 Azure Blob 時才有效。


outputStorageContainerSasToken - 儲存體容器 SAS 權杖
string.

指定用於存取所複製檔案之儲存體容器 SAS 權杖的變數名稱。 只有在選取的目的地是 Azure Blob 時才有效。


工作控制選項

除了工作輸入之外,所有工作都有控制選項。 如需詳細資訊,請參閱 控制選項和一般工作屬性

輸出變數

無。

備註

2.0 版的新功能:使用較新版本的 AzCopy。

規格需求

需求 描述
管線類型 YAML、傳統組建、傳統版本
在 上執行 Agent、DeploymentGroup
要求 自我裝載代理程式必須具備符合下列需求的功能,才能執行使用此工作的作業:azureps
Capabilities 此工作不符合作業中後續工作的任何需求。
命令限制 任何
可設定變數 任何
代理程式版本 1.103.0 或更新版本
工作類別 部署