microsoft / azure-pipelines-tasks

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

Could not find the module Az.Accounts with given version. If the module was recently installed, retry after restarting the Azure Pipelines task #19898

Open yoda96 opened 1 month ago

yoda96 commented 1 month ago

Task name

AzurePowerShell@5

Task version

No response

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

Azure DevOps Server type

Azure DevOps Server (Please specify exact version in the textbox below)

Azure DevOps Server Version (if applicable)

No response

Operation system

Windows11

Question

I am using below task in azure devops pipeline:
- task: AzurePowerShell@5
                      displayName: Helm deploy
                      inputs:
                        azureSubscription: ${{parameters.serviceConnection}}
                        TargetAzurePs: LatestVersion
                        azurePowerShellVersion: LatestVersion
                        ScriptType: FilePath
                        ScriptPath:
While executing the pipeline throws following error:
Exception: /azp/_work/_tasks/AzurePowerShell_72a1931b-effb-4d2e-8fd8-f8472a07cb62/4.239.7/InitializeAz.ps1:38
Line |
  38 |      throw ("Could not find the module Az.Accounts with given version. …
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Could not find the module Az.Accounts with given version. If the module
     | was recently installed, retry after restarting the Azure Pipelines task
     | agent.
v-schhabra commented 1 month ago

@yoda96 Could you please install Az.Accounts module in your machine in which agent is running and if Az.Accounts module is already installed then please try restarting your machine and check if that works fine. And share the debug logs of the pipeline by adding system.debug to "true".

v-schhabra commented 3 weeks ago

@yoda96 can you post your latest updates here?