Reputation: 33
I have tried so many times but still getting an error like below:
"The pipeline is not valid. Job Job: Step AzureFileCopy input ConnectedServiceNameARM references service connection xxxxx-xxx-xx-xxxx-xxxxxxxx which could not be found.The service connection does not exist or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz."
On the right side, there is a "Authorize resources" button. But whatever how I click it, it will show "An error occurred while auto-authorizing resources"
And here is part of my yaml file:
task: AzureFileCopy@3
inputs:
sourcePath:'AddFunction/bin/Debug/AddFunction.exe'
azureSubscription:'xxxxxx-xxxx-xxxx-xxxx-xxxxxxx'
destination: AzureBlob
storage:'1234'
containerName: 'test'
Also I have connected the Service connections on the Azure Pipeline, and I chose the "Azure Resource Manager" for my resource type.
Any ideas or pointers would be greatly appreciated.
Upvotes: 3
Views: 5103
Reputation: 1894
If you want to upload files to Azure Blob, you can do the exact same thing by Azure Cli in a Powershell script and trigger it through Powershell Task from Azure Pipeline.
# PowerShell
# Run a PowerShell script on Linux, macOS, or Windows
- task: PowerShell@2
inputs:
#targetType: 'filePath' # Optional. Options: filePath, inline
#filePath: # Required when targetType
The Powershell script will be like
#First, You have to login with a service principal.
az login --service-principal -u $AZ_NAME -p $AZ_PWD --tenant $AZ_TENANT
#upload your file by az storage blob
az storage blob upload --container-name $container_name --file $file_to_upload --name $blob_name
This may not be the perfect answer, but I hope it can help you and save your day.
Upvotes: 4