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

GenerateResourcesAndImage reaches error that Connect-AzAccount is not recognized #3465

Closed
5 of 7 tasks
norihiro opened this issue May 27, 2021 · 5 comments
Closed
5 of 7 tasks
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@norihiro
Copy link

Description
Following this instruction,
the script helpers/GenerateResourcesAndImage.ps1 calls Connect-AzAccount but it is not found.

Area for Triage:

I'm sorry, I'm not sure.

Question, Bug, or Feature?:
Bug
Maybe documentation need to be updated how to install Connect-AzAccount or the script should be revised not to use Connect-AzAccount.

Virtual environments affected

  • Ubuntu 16.04
  • Ubuntu 18.04
  • Ubuntu 20.04
  • macOS 10.15
  • macOS 11
  • Windows Server 2016 R2
  • Windows Server 2019

Image version
n/a

Expected behavior
The script GenerateResourcesAndImage.ps1 successfully runs.

Actual behavior
The script GenerateResourcesAndImage.ps1 shows an error as below.

GenerateResourcesAndImage : The term 'Connect-AzAccount' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.

Repro steps
A description with steps to reproduce the issue. If your have a public example or repo to share,
please provide the link.

  1. Open a Windows PowerShell
  2. Run these commands
    • choco install packer
    • Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; rm .\AzureCLI.msi
    • Set-Location c:\
    • git clone https://github.com/actions/virtual-environments.git
    • Set-Location C:\virtual-environments
    • Import-Module .\helpers\GenerateResourcesAndImage.ps1
    • GenerateResourcesAndImage -SubscriptionId {YourSubscriptionId} -ResourceGroupName "myTestResourceGroup" -ImageGenerationRepositoryRoot "$pwd" -ImageType Ubuntu1604 -AzureLocation "East US"
@maxim-lobanov
Copy link
Contributor

@al-cheb
Copy link
Contributor

al-cheb commented May 27, 2021

@norihiro, I have created #3466 PR with a section how to install Az module.

@dibir-magomedsaygitov dibir-magomedsaygitov added documentation Improvements or additions to documentation and removed needs triage labels May 27, 2021
@norihiro
Copy link
Author

I checked Apps & features shows Microsoft Azure CLI 2.24.0 but Connect-AzAccount is not found.
azure-cli

@maxim-lobanov
Copy link
Contributor

@norihiro Azure CLI != Azure PowerShell. It is two different tools. See updated guide: https://github.com/actions/virtual-environments/pull/3466/files

@norihiro
Copy link
Author

Thanks @maxim-lobanov,
I can install Azure PowerShell by Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force and now the command is found now.
Unfortunately I got another error below. It would be another problem I need to debug.

Set-AzContext : SharedTokenCacheCredential authentication failed: AADSTS9002332: Application
'1950a258-227b-4e31-a9cf-717495945fc2'(Microsoft Azure PowerShell) is configured for use by Azure Active Directory
users only. Please do not use the /consumers endpoint to serve this request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants