Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az account show reports "Error loading command module 'deploymentmanager'" #25607

Closed
bb-froggy opened this issue Feb 28, 2023 · 14 comments
Closed
Assignees
Labels
Account az login/account Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Milestone

Comments

@bb-froggy
Copy link

Related command
az account show

Describe the bug
In a GitHub Action with the windows-latest runner, I install the az Edge built from https://aka.ms/InstallAzureCliWindowsEdge. Running the command az account show says

ERROR: Error loading command module 'deploymentmanager': MGMT_DEPLOYMENTMANAGER
{
   "environmentName": "AzureCloud",
   "homeTenantId": "***",
   "id": "***",
   "isDefault": true,
   "managedByTenants": [],
   "name": "xyz",
   "state": "Enabled",
   "tenantId": "***",
   "user": {
     "name": "***",
     "type": "servicePrincipal"
   }
}

(line breaks were lost in the output and manually inserted back afterwards for readability, but may be at incorrect positions)

This error message does not appear in the normal az installation instead of the Edge built. It does not appear in Linux runners. It wasn't there on 19th February, but was there on 26th February.

To Reproduce
This is the GitHub workflow producing the issue: https://github.com/scepman/scepman-psmodule/blob/main/.github/workflows/test-in-lab.yml. The PowerShell script in the last step calls az account show.

Expected behavior
The deploymentmanager module should be loaded correctly and the error message should not appear.

Environment summary
I have configured an Environment in GitHub and Federated Authentication in Azure that azure/login action uses for authentication.

Additional context
I couldn't reproduce the behavior interactively on a Windows 10 desktop machine. This also makes it harder for me to debug.

@ghost ghost added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot Account az login/account labels Feb 28, 2023
@ghost ghost assigned jiasli Feb 28, 2023
@ghost ghost added this to the Backlog milestone Feb 28, 2023
@ghost ghost added the Installation label Feb 28, 2023
@yonzhan
Copy link
Collaborator

yonzhan commented Feb 28, 2023

@jiasli for awareness

@yonzhan yonzhan added Azure CLI Team The command of the issue is owned by Azure CLI team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that and removed Installation labels Feb 28, 2023
@bb-froggy
Copy link
Author

Probably caused by this PR: #25523

@jsntcy
Copy link
Member

jsntcy commented Mar 2, 2023

@bb-froggy could you please tell how we can reproduce this issue in our side as we cannot reproduce it on our local machine?

@bb-froggy
Copy link
Author

I have found a way to reproduce it now. On my Windows 10 machine with the Edge build of az, running az --help prints out the error message.

image

For reasons unknown to me, on my Windows 10 machine, az account show does not print it, while it does that on the GitHub runner.

@jsntcy
Copy link
Member

jsntcy commented Mar 2, 2023

@bb-froggy, thanks for the update. I cannot reproduce with az --help on my local machine as well.

  • Could you please help run az --help --debug on your machine again to help us get debug log for troubleshooting?
  • Could you please help check if "deploymentmanager" is in C:\Users\xxx.azure\commandIndex.json?

@bb-froggy
Copy link
Author

I just ran az --help --debug >c:\temp\temp\azoutput-1.txt 2>c:\temp\temp\azoutput-2.txt on the affected Windows 10 machine. This resulted in no console output and produced these two files:
azoutput-1.txt
azoutput-2.txt

The string "deploymentmanager" does not appear in my commandIndex.json

@zhoxing-ms
Copy link
Contributor

zhoxing-ms commented Mar 2, 2023

@bb-froggy Could you please show us the output of az --version command?
In addition, we guess this problem may be related to your installation environment. Have you installed CLI package in other ways in the local environment before?

@jsntcy
Copy link
Member

jsntcy commented Mar 2, 2023

@bb-froggy,

@bb-froggy
Copy link
Author

bb-froggy commented Mar 2, 2023

  • There was a folder deploymentmanager in c:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\command_modules\
  • I uninstalled two entries Azure CLI in "Programs and Features" and then installed AzureCliWindowsEdge again.

Now the problem is gone on this machine.

  • The last time, I already had the production 2.45.0 of Azure CLI installed and just installed the Edge version once again without uninstalling anything.

I missed running az --version before uninstalling. I remember it gave a json that said that azure-clie and core were version 2.45.0. Now, it is not a json anymore, but still version 2.45.0.

@bb-froggy
Copy link
Author

Last time I used az version instead of az --version, that's why it was a Json. I confused the two. Doesn't matter for the issue at hand, though.

@zhoxing-ms
Copy link
Contributor

The last time, I already had the production 2.45.0 of Azure CLI installed and just installed the Edge version once again without uninstalling anything.

Screenshot 2023-03-02 213329

@bb-froggy When you install the Edge version on the basis of production version 2.45.0, do you choose Repair as the installation way?

@bb-froggy
Copy link
Author

The wizard looked differently for me. It behaved just like there was no existing installation.

Probably the GitHub actions are an environment where this is more easy to reproduce. There, I installed az Edge with this powershell script on windows-latest:

$installUrl = 'https://aka.ms/InstallAzureCliWindowsEdge'
Write-Output "Installing az from  URL $installUrl"

$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri $installUrl -OutFile .\AzureCLI.msi
Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'
rm .\AzureCLI.msi

I can try to create a repository with a minimal example to reproduce this with a GitHub runner, but not today.

@bebound
Copy link
Contributor

bebound commented Mar 3, 2023

@bb-froggy We figure out this.
On windows, if the edge version and official version has same version number, installing the edge version does not remove official version first.
It only creates and overwrites files but does not delete the old file.

You need to uninstall the official before installing the edge version.

@bb-froggy
Copy link
Author

Okay, this works for me. In my GitHub Action, I do the following with powershell (not pwsh, which I believe wouldn't work) before installing the edge build:

          # Uninstall any previous version of az
          $azPackage = Get-Package -Name "*Azure CLI"
          if ($null -ne $azPackage) { $azPackage | Uninstall-Package }

This fixed the problem for me.

Since this problem is specific to the Edge build and does not affect the regular release, there is a working solution even for my use case, and you are updating the docs to point out the requirements to prevent this, I consider this issue fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Account az login/account Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

6 participants