Open benne opened 5 years ago
@starkmsu @onetocny @DmitriiBobreshev think anyone can possibly look into this issue from 2018?
AzCopy
may be used directly from AzureCLI@2
as follows
- task: AzureCLI@2
displayName: 'AzCopy via Azure CLI'
inputs:
azureSubscription: 'AzCopyARM'
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
$Date = (Get-Date).AddDays(1).ToString('yyyy-MM-dd')
$key = $( az storage account keys list --resource-group $(rgName) --account-name $(storageAccount) --query [0].value -o tsv )
$sas = $( az storage container generate-sas --name $(container) --expiry $Date --permissions "racwdli" --account-name $(storageAccount) --account-key "$key" )
azcopy copy "./seed_images/*" "https://$(storageAccount).blob.core.windows.net/$(container)/from_az_cli?$(SAS)" --recursive=true
See docs:
The following seems to work to "copy" text files (or shell scripts, or ....) to a VM from a pipeline, using a pipeline variable:
Disclaimer: I must admit I scared myself by doing this. Far from clean, but at least it seems to work.
jobs:
- job: TextCopyToVM
steps:
- bash: |
filePath="$(< path/to/some/text/file/from/git/repo.txt)"
#
# Replace \n with %0D%0A, so a multiline pipeline variable is possible
#
escapedFile=$(echo "$filePath" | sed ':a;N;$!ba;s/\n/%0D%0A/g')
echo "##vso[task.setvariable variable=localFileEscaped]$escapedFile"
- task: AzureCLI@2
displayName: 'Echo var into file'
inputs:
azureSubscription: '<Azure Subscription Name>'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
echo "localFileEscaped: $(localFileEscaped)"
COPY_FILE="$(az vm run-command invoke -g <RESOURCE GROUP> -n <VM NAME> --command-id RunShellScript --scripts 'echo "$(localFileEscaped)" > /some/path/to/file/on/vm.txt')"
Since this is still a thing with a recent comment and since I had same problem landing eventually here, I would like to tell that
az storage account update --name $ACCOUNT --resource-group $RESOURCE_GROUP --default-action Allow
otherwise the error you get is just telling you that you have authentication problem. This might save you a lot of hours thinking about your life choices while you are trying to resolve this.
This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days
We still want this feature ;)
+1
Yes we want this feature.
Also interested in seeing this given some love from Microsoft.
Environment
Server - Azure Pipelines Account name: chaosbyte Team project name: D Test Build definition name: D Test-CI Build number: 9
Agent - Hosted: Queue name: Not sure It is hosted a Ubuntu 16.04 build agent
Issue Description
I got a project building some pulling from an external Git repository, and building it with
gcc
through a simple bash script - no problem. However, when I attempt to use theAzure File Copy
task to copy over the single output file to a Azure Blob Storage container, I am told that this task won't run on Linux. Is there any plans to makeAzure File Copy
work on the hosted Ubuntu 16.04 build agent, or do you have any other suggestion on how to achieve the same result with existing tasks that will run on this hosted build server?Error logs