question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Azure File Copy Task Fails with Azure PS Version 1.4.0

See original GitHub issue

When a build agent has Azure PS Cmdlets version 1.4.0 installed the Azure File Copy Task will fail with the following error:

Cannot bind argument to parameter 'storageKey' because it is an empty string.

The previous version of Azure PS Cmdlets 1.3.2 works fine.


Raw Task Logs with Azure PS 1.4.0

2016-05-08T06:24:48.9801943Z Executing the powershell script: C:\Agent\tasks\AzureFileCopy\1.0.52\AzureFileCopy.ps1
2016-05-08T06:24:49.1676994Z Looking for Azure PowerShell module at C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Azure.psd1
2016-05-08T06:24:49.9958542Z AzurePSCmdletsVersion= 1.4.0
2016-05-08T06:24:50.0583559Z Get-ServiceEndpoint -Name ******** -Context Microsoft.TeamFoundation.DistributedTask.Agent.Worker.Common.TaskContext
2016-05-08T06:24:50.0739805Z tenantId= ********
2016-05-08T06:24:50.0739805Z azureSubscriptionId= ********
2016-05-08T06:24:50.0739805Z azureSubscriptionName= ********
2016-05-08T06:24:50.2146097Z Add-AzureRMAccount -ServicePrincipal -Tenant ******** -Credential System.Management.Automation.PSCredential
2016-05-08T06:24:50.7982308Z Select-AzureRMSubscription -SubscriptionId ******** -tenantId ********
2016-05-08T06:24:51.0235517Z ##[debug]Loading AzureUtilityGTE1.1.0.ps1
2016-05-08T06:24:57.3994077Z ##[error]Cannot bind argument to parameter 'storageKey' because it is an empty string.

Raw Task Logs with Azure PS 1.3.2

2016-05-08T06:56:10.0177511Z Executing the powershell script: C:\Agent\tasks\AzureFileCopy\1.0.52\AzureFileCopy.ps1
2016-05-08T06:56:10.2052547Z Looking for Azure PowerShell module at C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Azure.psd1
2016-05-08T06:56:11.0646512Z AzurePSCmdletsVersion= 1.3.2
2016-05-08T06:56:11.1271528Z Get-ServiceEndpoint -Name ******** -Context Microsoft.TeamFoundation.DistributedTask.Agent.Worker.Common.TaskContext
2016-05-08T06:56:11.1427777Z tenantId= ********
2016-05-08T06:56:11.1427777Z azureSubscriptionId= ********
2016-05-08T06:56:11.1427777Z azureSubscriptionName= ********
2016-05-08T06:56:11.2834062Z Add-AzureRMAccount -ServicePrincipal -Tenant ******** -Credential System.Management.Automation.PSCredential
2016-05-08T06:56:11.7897892Z Select-AzureRMSubscription -SubscriptionId ******** -tenantId ********
2016-05-08T06:56:11.9616688Z ##[debug]Loading AzureUtilityGTE1.1.0.ps1
2016-05-08T06:56:14.5176791Z Uploading files from source path: 'D:\Agent\Work\326ad65b5\********.Backend.CI\Backend\artifacts\package.zip' to storage account: '********' in container: '********' with blobprefix: 'deployments/********'
2016-05-08T06:56:16.7210196Z Uploaded files successfully from source path: 'D:\Agent\Work\326ad65b5\********.Backend.CI\Backend\artifacts\package.zip' to storage account: '********' in container: '********' with blobprefix: 'deployments/********'

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:21 (11 by maintainers)

github_iconTop GitHub Comments

7reactions
antmeehancommented, Jun 2, 2016

While waiting for the fix, we’ve manually patched AzureFileCopy\1.0.54\AzureUtilityGTE1.0.ps1 as follows:

function Get-AzureStorageKeyFromARM
{
    param([string]$storageAccountName)

    if (-not [string]::IsNullOrEmpty($storageAccountName))
    {
        # get azure storage account resource group name
        $azureResourceGroupName = Get-AzureStorageAccountResourceGroupName -storageAccountName $storageAccountName

        Write-Verbose "[Azure Call]Retrieving storage key for the storage account: $storageAccount in resource group: $azureResourceGroupName"
        $storageKeyDetails = Get-AzureRMStorageAccountKey -ResourceGroupName $azureResourceGroupName -Name $storageAccountName -ErrorAction Stop
        $storageKey = $storageKeyDetails[0].Value
        Write-Verbose "[Azure Call]Retrieved storage key successfully for the storage account: $storageAccount in resource group: $azureResourceGroupName"

        return $storageKey
    }
}

The line:

        $storageKey = $storageKeyDetails[0].Value

is what has been changed.

2reactions
edtheshedcommented, Aug 9, 2016

I also have this issue now with 1.0.69. Surely this shouldn’t be closed…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure File Copy Task Fails with Azure PS Version 1.4.0
When a build agent has Azure PS Cmdlets version 1.4.0 installed the Azure File Copy Task will fail with the following error: Cannot...
Read more >
Azure File Copy Task Error - Visual Studio Feedback
When running an existing build we are getting the following error: InvalidApiVersionParameter : The api-version '2018-05-01' is invalid.
Read more >
Azure PowerShell release notes
Migrated following Azure File dataplane cmdlets from 'Microsoft. ... Fixed copy blob failure on Premium Storage account, or account enabled ...
Read more >
azure - AzureFileCopy task not working (AzureRM module ...
From my test, I am failing with Azure File Copy task version 5.*. enter image description here. The same configuration succeeds with Azure...
Read more >
Fixing issue related to Package is not compatible with ...
Fixing issue related to Package is not compatible with netcoreapp2.1, supports netstandard2.0, when using Azure DevOps (VSTS). Tobias Zimmergren.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found