microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.5k stars 2.61k forks source link

[BUG]: Azure file copy version 6.* is displaying some warnings #20414

Open luislhg opened 2 months ago

luislhg commented 2 months ago

New issue checklist

Task name

Azure file copy

Task version

6.245.1 (6.*)

Issue Description

When using task Azure file copy version 6.* (6.245.1) it is always displaying 3 warnings to the pipeline output.

image The names of some imported commands from the module 'Microsoft.Azure.PowerShell.Cmdlets.Network' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.

The names of some imported commands from the module 'Az.Network' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.

You're using Az.Storage version 7.1.0. The latest version of Az.Storage is 7.3.1. Upgrade your Az modules using the following commands:

Environment type (Please select at least one enviroment where you face this issue)

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Windows-2022

Relevant log output

Starting: AzureBlob File Copy Server
==============================================================================
Task         : Azure file copy
Description  : Copy files to Azure Blob Storage or virtual machines
Version      : 6.245.1
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-file-copy
==============================================================================
Added TLS 1.2 in session.
Import-Module -Name C:\Modules\az_12.1.0\Az.Accounts\3.0.3\Az.Accounts.psd1 -Global
Enable-AzureRmAlias -Scope Process
Clear-AzContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue
Clear-AzContext -Scope Process
Clear-AzConfig -DefaultSubscriptionForLogin
Connect-AzAccount 

Import-Module -Name C:\Modules\az_12.1.0\Az.Resources\7.2.0\Az.Resources.psd1 -Global
Import-Module -Name C:\Modules\az_12.1.0\Az.Storage\7.1.0\Az.Storage.psd1 -Global
Import-Module -Name C:\Modules\az_12.1.0\Az.Compute\8.1.0\Az.Compute.psd1 -Global
Import-Module -Name C:\Modules\az_12.1.0\Az.Network\7.8.0\Az.Network.psd1 -Global
##[warning]The names of some imported commands from the module 'Microsoft.Azure.PowerShell.Cmdlets.Network' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
##[warning]The names of some imported commands from the module 'Az.Network' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
##[warning]You're using Az.Storage version 7.1.0. The latest version of Az.Storage is 7.3.1. Upgrade your Az modules using the following commands:
  Update-Module Az.* -WhatIf    -- Simulate updating your Az modules.
  Update-Module Az.*            -- Update your Az modules

Full task logs with system.debug enabled

 [REPLACE THIS WITH YOUR INFORMATION] 

Repro steps

No response

mrebuffet commented 2 months ago

Same issue here. Looking at the history, this has been an issue on and off since AzureFileCopy@4. I have been able to remove the last warning by adding this env option:

- task: AzureFileCopy@6
  displayName: 'Copy files to storage'
  inputs:
     SourcePath: ....
     [Other options]: ...
  env:
     RETIRE_AZURERM_POWERSHELL_MODULE: true

I can't find a way to remove the other 2 about Network.

v-schhabra commented 1 month ago

@luislhg @mrebuffet Can we know from which version of the task you are getting this warning?

v-schhabra commented 1 week ago

We investigated and find out that we are getting the warning from Azure- powershell so will be collaborating with Azure Powershell team to check on this.

"The names of some imported commands from the module 'Microsoft.Azure.PowerShell.Cmdlets.Network' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb".

komjera commented 5 days ago

Hi!

We are also experiencing these warnings on ms hosted agents.

Since we have more than one subscription we are also seeing the warning

TenantId '***' contains more than one active subscription. First one will be selected for further use. To select another subscription, use Set-AzContext.

This is our task usage

- task: AzureFileCopy@6
  displayName: "Copy code to storage account"
  inputs:
    SourcePath: "$(Pipeline.Workspace)/[REDACTED]/*"
    azureSubscription: "${{ variables.resourceManagerConnection }}"
    Destination: AzureBlob
    storage: "[REDACTED]"
    ContainerName: "$web"
    outputStorageUri: "[REDACTED]"

azureSubscription is refering to a specific subscription in our tenant..