I try to copy ARM templates to storage but failing. What could wrong with YML?
ERROR:
& "AzCopy\AzCopy.exe" logout
INFO: Logout succeeded.
INFO: AzCopy.exe: A newer version 10.4.3 is available to download
Disconnect-AzAccount -Scope Process -ErrorAction Stop
Clear-AzContext -Scope Process -ErrorAction Stop
##[error]Upload to container: 'arm' in storage account: 'devopsstorageken' with blob prefix: 'test'
failed with error: 'AzCopy.exe exited with non-zero exit code while uploading files to blob storage.'
For more info please refer to https://aka.ms/azurefilecopyreadme
Finishing: AzureFileCopy
YML:
- task: AzureFileCopy@4
inputs:
SourcePath: '$(Build.Repository.LocalPath)/ARMTemplates/CreateSQLServerARM'
azureSubscription: 'TestRG-Conn'
Destination: 'AzureBlob'
storage: 'devopsstorageken'
blobPrefix: 'test'
ContainerName: 'arm'
The client secret or certificate password must be placed in the appropriate environment variable. Type AzCopy env to see names and descriptions of environment variables. --tenant-id (string) The Azure Active Directory tenant ID to use for OAuth device interactive login.
We need to start this command with the utility name, azCopy, followed by the "sync" command, which will help sync files between two locations. Then we need to provide the source location from where the files will be synced. Lastly, we need to provide a destination, a complete path of the Azure Blob storage container.
Objects in Blob Storage are accessible via the Azure Storage REST API, Azure PowerShell, Azure CLI, or an Azure Storage client library.
I try to copy ARM templates to storage but failing. What could wrong with YML?
Your yml looks right. I guess there might be something wrong with the task itself.
As a workaround we can use the AzureFileCopy@3
, in this version we don't need to do any extra job in Azure Web Portal.
And in preview AzureFileCopy@4
, there's some difference. We need to make sure the Service Principal
we use in this task have access to the Storage Account. For me, I need to navigate to Access control
page and Add a role assignment
(Storage Blob Data Contributor/owner role) to my Service Principal/Managed Identity:
So that the AzureFileCopy version4 could also work on my side.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With