Azure / Azure/azure-powershell

The term 'Connect-AzAccount' is not recognized as a name of a cmdlet, function, script file, or executable program.

Open
#18,424 16 comments 0 reactions 0 assignees View on GitHub
Accounts customer-reported needs-team-attention question
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description

I found out that with the latest version of The Az.Accounts, 2.8.0, running the follow command:
`Connect-AzAccount -AccessToken $token -AccountId $subscriptionId -Subscription $subscriptionId
`
produce the follow error:
![image](https://user-images.githubusercontent.com/3593840/172411977-7d5b328a-992b-414d-9a9d-bd8650f5bcd2.png)

Using the 2.7.6 version of the same module it works properly

### Issue script & Debug output

```PowerShell
pwsh
PowerShell 7.2.2
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

A new PowerShell stable release is available: v7.2.4
Upgrade now, or check out the release page at:
https://aka.ms/PowerShell-Release?tag=v7.2.4

PS /workspaces/DevOpsInfra/ota-linux-vm-packer> $DebugPreference='Continue'
PS /workspaces/DevOpsInfra/ota-linux-vm-packer> Install-Module -Name Az.Accounts -Repository PSGallery -Force -AllowClobber
DEBUG: 00:00:00.0000871 Trying provider assembly: /opt/microsoft/powershell/7/Modules/PackageManagement/coreclr/netstandard2.0/Microsoft.PackageManagement.NuGetProvider.dll
DEBUG: 00:00:00.0000005 Trying provider assembly: /opt/microsoft/powershell/7/Modules/PackageManagement/coreclr/netstandard2.0/Microsoft.PackageManagement.ArchiverProviders.dll
DEBUG: 00:00:00.0001167 Trying provider assembly: /opt/microsoft/powershell/7/Modules/PackageManagement/coreclr/netstandard2.0/Microsoft.PackageManagement.MetaProvider.PowerShell.dll
DEBUG: 00:00:00.0031257 Attempting loading of assembly: /opt/microsoft/powershell/7/Modules/PackageManagement/coreclr/netstandard2.0/Microsoft.PackageManagement.MetaProvider.PowerShell.dll
DEBUG: 00:00:00.0033735 Attempting loading of assembly: /opt/microsoft/powershell/7/Modules/PackageManagement/coreclr/netstandard2.0/Microsoft.PackageManagement.ArchiverProviders.dll
DEBUG: 00:00:00.0001233 Trying provider assembly: /opt/microsoft/powershell/7/Modules/PackageManagement/coreclr/netstandard2.0/Microsoft.PackageManagement.CoreProviders.dll
DEBUG: 00:00:00.0037704 Attempting loading of assembly: /opt/microsoft/powershell/7/Modules/PackageManagement/coreclr/netstandard2.0/Microsoft.PackageManagement.NuGetProvider.dll
DEBUG: 00:00:00.0039378 Attempting loading of assembly: /opt/microsoft/powershell/7/Modules/PackageManagement/coreclr/netstandard2.0/Microsoft.PackageManagement.CoreProviders.dll
DEBUG: 00:00:00.0739044 Registering providers via metaproviders for assembly Microsoft.PackageManagement.MetaProvider.PowerShell.Internal.PowerShellMetaProvider
DEBUG: 00:00:00.1793462 Trying to register metaprovider
DEBUG: 00:00:00.1703722 Initializing provider 'zipfile'
DEBUG: 00:00:00.1701858 Initializing provider 'NuGet'
DEBUG: 00:00:00.2247540 Initializing PowerShell MetaProvider
DEBUG: 00:00:00.1698958 Initializing provider 'Bootstrap'
DEBUG: 00:00:00.1701135 Initializing provider 'WebDownloader'
DEBUG: 00:00:00.2313562 Provider 'zipfile' Initialized
DEBUG: 00:00:00.2317766 Using Archiver Provider zipfile
DEBUG: 00:00:00.2462240 Calling 'NuGet'::'InitializeProvider'.
DEBUG: 00:00:00.2464434 Provider 'NuGet' Initialized
DEBUG: 00:00:00.2465109 Using Package Provider NuGet
DEBUG: 00:00:00.2809350 Provider 'WebDownloader' Initialized
DEBUG: 00:00:00.2829637 Using Downloader Provider WebDownloader
DEBUG: 00:00:00.3084456 Attempting to load PowerShell Provider Module [/opt/microsoft/powershell/7/Modules/PowerShellGet/PSModule.psm1]
DEBUG: 00:00:00.3103425 Initialize Bootstrapper
DEBUG: 00:00:00.3130522 Provider 'Bootstrap' Initialized
DEBUG: 00:00:00.3131836 Using Package Provider Bootstrap
DEBUG: 00:00:00.3299226 Calling 'NuGet'::'GetFeatures'.
DEBUG: 00:00:00.3301041 Calling 'zipfile::GetFeatures'
DEBUG: 00:00:00.3320022 Calling 'WebDownloader::GetFeatures'
DEBUG: 00:00:00.3375899 The provider 'NuGet' is imported
DEBUG: 00:00:00.3376601 SUCCESS provider assembly: /opt/microsoft/powershell/7/Modules/PackageManagement/coreclr/netstandard2.0/Microsoft.PackageManagement.ArchiverProviders.dll
DEBUG: 00:00:00.3382788 SUCCESS provider assembly: /opt/microsoft/powershell/7/Modules/PackageManagement/coreclr/netstandard2.0/Microsoft.PackageManagement.NuGetProvider.dll
DEBUG: 00:00:00.3440152 Calling 'Bootstrap::GetFeatures'
DEBUG: 00:00:00.3469247 The provider 'Bootstrap' is imported
DEBUG: 00:00:00.3476100 SUCCESS provider assembly: /opt/microsoft/powershell/7/Modules/PackageManagement/coreclr/netstandard2.0/Microsoft.PackageManagement.CoreProviders.dll
DEBUG: 00:00:00.4139696 Loaded PowerShell package provider: '[/opt/microsoft/powershell/7/Modules/PowerShellGet/PSModule.psm1]'.
DEBUG: 00:00:00.4251619 Loaded PowerShell Provider: PowerShellGet
DEBUG: 00:00:00.4287441 Initializing provider 'PowerShellGet'
DEBUG: 00:00:00.4396495 Calling New() : MethodName = 'InitializeProvider'
DEBUG: 00:00:00.4398553 WarningAction: SilentlyContinue
DEBUG: 00:00:00.4398885 ErrorAction: SilentlyContinue
DEBUG: 00:00:00.4476721 INVOKING PowerShell Fn Initialize-Provider with args that has length 0
DEBUG: 00:00:00.4644284 In PowerShellGet Provider - 'Initialize-Provider'.
DEBUG: 00:00:00.4652521 PowerShell Script 'PSModule' Function 'Initialize-Provider' returns null.
DEBUG: 00:00:00.4667238 Done calling powershell «Initialize-Provider» «PSModule»
DEBUG: 00:00:00.4669577 Provider 'PowerShellGet' Initialized
DEBUG: 00:00:00.4669903 Using Package Provider PowerShellGet
DEBUG: 00:00:00.4761582 Calling New() : MethodName = 'GetFeatures'
DEBUG: 00:00:00.4763157 WarningAction: SilentlyContinue
DEBUG: 00:00:00.4763700 ErrorAction: SilentlyContinue
DEBUG: 00:00:00.4838342 INVOKING PowerShell Fn Get-Feature with args that has length 0
DEBUG: 00:00:00.4912277 In PowerShellGet Provider - 'Get-Feature'.
DEBUG: 00:00:00.5053233 Done calling powershell «Get-Feature» «PSModule»
DEBUG: 00:00:00.5056009 The provider 'PowerShellGet' is imported
DEBUG: 00:00:00.5089011 SUCCESS provider assembly: /opt/microsoft/powershell/7/Modules/PackageManagement/coreclr/netstandard2.0/Microsoft.PackageManagement.MetaProvider.PowerShell.dll
DEBUG: 00:00:00.0000008 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:00.0003002 ErrorVariable: ev
DEBUG: 00:00:00.0003544 Name: PSGallery
DEBUG: 00:00:00.0003838 Verbose: False
DEBUG: 00:00:00.0018454 INVOKING PowerShell Fn Resolve-PackageSource with args that has length 0
DEBUG: 00:00:00.0154528 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:00.1174007 Yielding package source for PSGallery at location https://www.powershellgallery.com/api/v2
DEBUG: 00:00:00.1206795 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.1387258 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.1387915 ErrorVariable: ev
DEBUG: 00:00:00.1388118 Name: PSGallery
DEBUG: 00:00:00.1388238 Verbose: False
DEBUG: 00:00:00.1397305 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1
DEBUG: 00:00:00.1492534 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.1613108 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.1656004 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.1656707 ErrorVariable: ev
DEBUG: 00:00:00.1656959 Name: PSGallery
DEBUG: 00:00:00.1657408 Verbose: False
DEBUG: 00:00:00.1664981 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1
DEBUG: 00:00:00.1671416 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.1697281 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.2274995 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:00.2283823 ProviderName: PowerShellGet
DEBUG: 00:00:00.2293319 ErrorVariable: ev
DEBUG: 00:00:00.2303267 Name: PSGallery
DEBUG: 00:00:00.2319093 Verbose: False
DEBUG: 00:00:00.2340640 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:00.2407430 INVOKING PowerShell Fn Resolve-PackageSource with args that has length 0
DEBUG: 00:00:00.2440046 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:00.2627327 Yielding package source for PSGallery at location https://www.powershellgallery.com/api/v2
DEBUG: 00:00:00.2812318 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.2984620 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:00.2994352 ProviderName: PowerShellGet
DEBUG: 00:00:00.3001732 ErrorVariable: ev
DEBUG: 00:00:00.3014548 Name: PSGallery
DEBUG: 00:00:00.3026227 Verbose: False
DEBUG: 00:00:00.3086530 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:00.3126254 INVOKING PowerShell Fn Resolve-PackageSource with args that has length 0
DEBUG: 00:00:00.3161157 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:00.3227684 Yielding package source for PSGallery at location https://www.powershellgallery.com/api/v2
DEBUG: 00:00:00.3294992 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.0000005 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:00.0001234 Name: Az.Accounts
DEBUG: 00:00:00.0001615 Force: True
DEBUG: 00:00:00.0001913 Source: PSGallery
DEBUG: 00:00:00.0012949 INVOKING PowerShell Fn Resolve-PackageSource with args that has length 0
DEBUG: 00:00:00.0024065 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:00.0289308 Yielding package source for PSGallery at location https://www.powershellgallery.com/api/v2
DEBUG: 00:00:00.0302182 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.0372427 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0372945 Name: Az.Accounts
DEBUG: 00:00:00.0373169 Force: True
DEBUG: 00:00:00.0373344 Source: PSGallery
DEBUG: 00:00:00.0382534 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1
DEBUG: 00:00:00.0391180 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0413633 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0481114 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0481607 Name: Az.Accounts
DEBUG: 00:00:00.0481816 Force: True
DEBUG: 00:00:00.0482021 Source: PSGallery
DEBUG: 00:00:00.0491042 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1
DEBUG: 00:00:00.0500581 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0547234 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0612893 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0613395 Name: Az.Accounts
DEBUG: 00:00:00.0613556 Force: True
DEBUG: 00:00:00.0613682 Source: PSGallery
DEBUG: 00:00:00.0626036 INVOKING PowerShell Fn Get-DynamicOptions with args Package that has length 1
DEBUG: 00:00:00.0637636 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0799003 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0937757 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0938303 Name: Az.Accounts
DEBUG: 00:00:00.0938506 Force: True
DEBUG: 00:00:00.0938645 Source: PSGallery
DEBUG: 00:00:00.0953579 INVOKING PowerShell Fn Get-DynamicOptions with args Install that has length 1
DEBUG: 00:00:00.0963688 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.1035768 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.1279442 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:00.1285955 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:00.1291861 Force: True
DEBUG: 00:00:00.1296655 Name: Az.Accounts
DEBUG: 00:00:00.1301444 ProviderName: PowerShellGet
DEBUG: 00:00:00.1307261 AllowClobber: True
DEBUG: 00:00:00.1315009 Scope: CurrentUser
DEBUG: 00:00:00.1324476 Type: Module
DEBUG: 00:00:00.1333684 Source: PSGallery
DEBUG: 00:00:00.1354370 INVOKING PowerShell Fn Resolve-PackageSource with args that has length 0
DEBUG: 00:00:00.1394550 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:00.1553176 Yielding package source for PSGallery at location https://www.powershellgallery.com/api/v2
DEBUG: 00:00:00.1574223 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.1603623 Calling SearchForPackages. Name='Az.Accounts'
DEBUG: 00:00:00.1718220 PackageProvider::FindPackage with name Az.Accounts
DEBUG: 00:00:00.1738667 Calling SearchForPackages After Select 1
DEBUG: 00:00:00.1884360 Calling New() : MethodName = 'FindPackage'
DEBUG: 00:00:00.1899357 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:00.1909175 Force: True
DEBUG: 00:00:00.1921864 Name: Az.Accounts
DEBUG: 00:00:00.1928525 ProviderName: PowerShellGet
DEBUG: 00:00:00.1941099 AllowClobber: True
DEBUG: 00:00:00.1966769 Scope: CurrentUser
DEBUG: 00:00:00.2048230 Type: Module
DEBUG: 00:00:00.2081326 Source: PSGallery
DEBUG: 00:00:00.2277449 INVOKING PowerShell Fn Find-Package with args System.String[], , , that has length 4
DEBUG: 00:00:00.3142894 In PowerShellGet Provider - 'Find-Package'.
DEBUG: 00:00:00.3181733 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:00.3191260 OPTION: Force => True
DEBUG: 00:00:00.3199049 OPTION: Name => Az.Accounts
DEBUG: 00:00:00.3214903 OPTION: ProviderName => PowerShellGet
DEBUG: 00:00:00.3242121 OPTION: AllowClobber => True
DEBUG: 00:00:00.3255406 OPTION: Scope => CurrentUser
DEBUG: 00:00:00.3269035 OPTION: Type => Module
DEBUG: 00:00:00.3282003 OPTION: Source => PSGallery
DEBUG: 00:00:00.4161248 PackageProvider::FindPackage with name Az.Accounts
DEBUG: 00:00:00.4240014 Calling 'NuGet'::'FindPackage' - name='Az.Accounts', requiredVersion='',minimumVersion='', maximumVersion='''.
DEBUG: 00:00:00.4372745 Iterating 'Az.Accounts'.
DEBUG: 00:00:00.4606604 Calling 'NuGetRequest'::'RegisteredPackageSources', '/home/vscode/.config/NuGet/nuget.config'.
DEBUG: 00:00:00.4622758 Loading a configuration from file '/home/vscode/.config/NuGet/nuget.config'.
DEBUG: 00:00:00.4677683 Loaded a configuration from file '/home/vscode/.config/NuGet/nuget.config'.
DEBUG: 00:00:00.4714592 There are '0' registered sources in 'NuGet' provider.
DEBUG: 00:00:00.4741328 Source 'https://www.powershellgallery.com/api/v2' is not one of the registered sources in 'NuGet' provider.
DEBUG: 00:00:01.7728242 Downloading 'https://www.powershellgallery.com/api/v2'.
DEBUG: 00:00:01.9105923 Completed downloading 'https://www.powershellgallery.com/api/v2'.
DEBUG: 00:00:01.9136218 Source 'https://www.powershellgallery.com/api/v2' is validated.
DEBUG: 00:00:01.9170695 Calling 'NuGetRequest'::'GetPackageById', 'Az.Accounts'.
DEBUG: 00:00:01.9193765 Calling 'NuGetPackageRepository'::'FindPackagesById', 'Az.Accounts'.
DEBUG: 00:00:01.9214438 Calling 'NuGetPackageFeed2'::'FindPackage', 'Az.Accounts'.
DEBUG: 00:00:01.9230728 Calling 'NuGetClient'::'FindPackage'.
DEBUG: 00:00:01.9382690 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=0&$top=40'.
DEBUG: 00:00:02.1162983 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=0&$top=40'.
DEBUG: 00:00:02.1334785 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=0&$top=40'.
DEBUG: 00:00:02.3126129 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=0&$top=40'.
DEBUG: 00:00:02.3210257 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=80&$top=40'.
DEBUG: 00:00:02.3212161 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=40&$top=40'.
DEBUG: 00:00:02.3216368 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=120&$top=40'.
DEBUG: 00:00:02.3345270 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=160&$top=40'.
DEBUG: 00:00:02.9087863 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=80&$top=40'.
DEBUG: 00:00:02.9099611 '0' packages received in the last request.
DEBUG: 00:00:03.0774973 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=40&$top=40'.
DEBUG: 00:00:03.0815920 '25' packages received in the last request.
DEBUG: 00:00:03.2457073 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=120&$top=40'.
DEBUG: 00:00:03.2466421 '0' packages received in the last request.
DEBUG: 00:00:03.4125620 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=160&$top=40'.
DEBUG: 00:00:03.4135681 '0' packages received in the last request.
DEBUG: 00:00:03.4164520 Completed iterating for 'Az.Accounts'.
DEBUG: 00:00:03.5540049 Done calling powershell «Find-Package» «PSModule»
DEBUG: 00:00:03.5705505 Calling New() : MethodName = 'GetInstalledPackages'
DEBUG: 00:00:03.5710422 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:03.5714587 Force: True
DEBUG: 00:00:03.5717946 Name: Az.Accounts
DEBUG: 00:00:03.5721967 ProviderName: PowerShellGet
DEBUG: 00:00:03.5725539 AllowClobber: True
DEBUG: 00:00:03.5728520 Scope: CurrentUser
DEBUG: 00:00:03.5733288 Type: Module
DEBUG: 00:00:03.5736573 Source: PSGallery
DEBUG: 00:00:03.5828491 INVOKING PowerShell Fn Get-InstalledPackage with args Az.Accounts, 2.8.0, , that has length 4
DEBUG: 00:00:03.5877572 In PowerShellGet Provider - 'Get-InstalledPackage'.
DEBUG: 00:00:03.5888584 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:03.5901682 OPTION: Force => True
DEBUG: 00:00:03.5912237 OPTION: Name => Az.Accounts
DEBUG: 00:00:03.5919876 OPTION: ProviderName => PowerShellGet
DEBUG: 00:00:03.5936881 OPTION: AllowClobber => True
DEBUG: 00:00:03.6076953 OPTION: Scope => CurrentUser
DEBUG: 00:00:03.6089828 OPTION: Type => Module
DEBUG: 00:00:03.6102950 OPTION: Source => PSGallery
DEBUG: 00:00:04.6674809 Done calling powershell «Get-InstalledPackage» «PSModule»
DEBUG: 00:00:04.6754133 Calling New() : MethodName = 'InstallPackage'
DEBUG: 00:00:04.6761235 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:04.6767203 Force: True
DEBUG: 00:00:04.6772497 Name: Az.Accounts
DEBUG: 00:00:04.6782355 ProviderName: PowerShellGet
DEBUG: 00:00:04.6791088 AllowClobber: True
DEBUG: 00:00:04.6797560 Scope: CurrentUser
DEBUG: 00:00:04.6803930 Type: Module
DEBUG: 00:00:04.6810050 Source: PSGallery
DEBUG: 00:00:04.6831394 INVOKING PowerShell Fn Install-Package with args NuGet|Az.Accounts|2.8.0|https://www.powershellgallery.com/api/v2|Module that has length 1
DEBUG: 00:00:04.6865439 In PowerShellGet Provider - 'Install-Package'.
DEBUG: 00:00:04.7395341 In PowerShellGet Provider - 'Install-PackageUtility'.
DEBUG: 00:00:04.7416446 The FastPackageReference is 'NuGet|Az.Accounts|2.8.0|https://www.powershellgallery.com/api/v2|Module'.
DEBUG: 00:00:04.7525839 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:04.7532673 OPTION: Force => True
DEBUG: 00:00:04.7539054 OPTION: Name => Az.Accounts
DEBUG: 00:00:04.7548791 OPTION: ProviderName => PowerShellGet
DEBUG: 00:00:04.7559873 OPTION: AllowClobber => True
DEBUG: 00:00:04.7577856 OPTION: Scope => CurrentUser
DEBUG: 00:00:04.7594890 OPTION: Type => Module
DEBUG: 00:00:04.7602899 OPTION: Source => PSGallery
DEBUG: 00:00:04.7837408 ArtifactType is Module
DEBUG: 00:00:04.8439167 Calling 'NuGet'::'InstallPackage', '$aHR0cHM6Ly93d3cucG93ZXJzaGVsbGdhbGxlcnkuY29tL2FwaS92Mg==\QXouQWNjb3VudHM=\Mi44LjA=\aHR0cHM6Ly93d3cucG93ZXJzaGVsbGdhbGxlcnkuY29tL2FwaS92Mg==\cG93ZXJzaGVsbGdldA=='.
DEBUG: 00:00:04.8459077 Calling 'NuGetRequest'::'GetPackageByFastpath', '$aHR0cHM6Ly93d3cucG93ZXJzaGVsbGdhbGxlcnkuY29tL2FwaS92Mg==\QXouQWNjb3VudHM=\Mi44LjA=\aHR0cHM6Ly93d3cucG93ZXJzaGVsbGdhbGxlcnkuY29tL2FwaS92Mg==\cG93ZXJzaGVsbGdldA=='.
DEBUG: 00:00:04.8517920 Calling 'NuGetRequest'::'ResolvePackageSource', 'https://www.powershellgallery.com/api/v2'.
DEBUG: 00:00:04.8533178 Calling 'NuGetRequest'::'FindRegisteredSource', 'https://www.powershellgallery.com/api/v2'.
DEBUG: 00:00:04.8545261 Source 'https://www.powershellgallery.com/api/v2' is not one of the registered sources in 'NuGet' provider.
DEBUG: 00:00:05.4522876 Calling 'NuGetPackageRepository'::'FindPackage', 'Az.Accounts'.
DEBUG: 00:00:05.4527348 Calling 'NuGetPackageFeed2'::'FindPackage', 'Az.Accounts'.
DEBUG: 00:00:05.4531827 Calling 'NuGetClient'::'FindPackage'.
DEBUG: 00:00:05.4556113 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=0&$top=40'.
DEBUG: 00:00:06.0686743 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=0&$top=40'.
DEBUG: 00:00:06.0931334 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=80&$top=40'.
DEBUG: 00:00:06.0933692 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=120&$top=40'.
DEBUG: 00:00:06.0935225 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=160&$top=40'.
DEBUG: 00:00:06.0938824 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=40&$top=40'.
DEBUG: 00:00:06.2412925 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=80&$top=40'.
DEBUG: 00:00:06.2423055 '0' packages received in the last request.
DEBUG: 00:00:06.3867564 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=120&$top=40'.
DEBUG: 00:00:06.3874175 '0' packages received in the last request.
DEBUG: 00:00:06.5494919 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=160&$top=40'.
DEBUG: 00:00:06.5503483 '0' packages received in the last request.
DEBUG: 00:00:06.7086631 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Az.Accounts'&$skip=40&$top=40'.
DEBUG: 00:00:06.7119687 '25' packages received in the last request.
DEBUG: 00:00:06.7136051 'Package version' is '2.8.0'.
DEBUG: 00:00:06.7149643 'Request's Destination' is '/tmp/512226785'.
DEBUG: 00:00:06.7159887 Calling 'NuGetPackageRepository'::'InstallPackage'.
DEBUG: 00:00:06.7174824 Calling 'NuGetFilesFeed2'::'InstallPackage'.
DEBUG: 00:00:06.7184056 Calling 'NuGetFilesFeed2'::'InstallPackage', '$aHR0cHM6Ly93d3cucG93ZXJzaGVsbGdhbGxlcnkuY29tL2FwaS92Mg==\QXouQWNjb3VudHM=\Mi44LjA=\aHR0cHM6Ly93d3cucG93ZXJzaGVsbGdhbGxlcnkuY29tL2FwaS92Mg==\cG93ZXJzaGVsbGdldA=='.
DEBUG: 00:00:06.7236069 Calling 'NuGetClient'::'GetPackageDependencies'.
DEBUG: 00:00:06.7340788 Returning the call 'NuGetClient'::'GetPackageDependencies'.
DEBUG: 00:00:06.7623924 Calling 'NuGetClient'::'InstallPackage'.
DEBUG: 00:00:07.5420916 Calling 'NuGetClient'::'InstallPackageLocal'.
DEBUG: 00:00:07.5678273 /tmp/512226785/Az.Accounts.2.8.0/Az.Accounts.2.8.0.nupkg
DEBUG: 00:00:07.7764991 Returning the call 'NuGetClient'::'InstallPackageLocal'.
DEBUG: 00:00:07.8177953 Returning the call 'NuGetClient'::'InstallSinglePackage'.
DEBUG: 00:00:07.8195245 Returning the call 'NuGetFilesFeed2'::'InstallPackage'.
DEBUG: 00:00:08.2768914 Done calling powershell «Install-Package» «PSModule»

PS > $token = "MY_TOKEN"
PS > $subscriptionId = "MY_SUBSCRIPTION_ID"
PS > Connect-AzAccount -AccessToken $token -AccountId $subscriptionId -Subscription $subscriptionId
DEBUG: Registering Az shared AssemblyLoadContext for path: '/home/vscode/.local/share/powershell/Modules/Az.Accounts/2.8.0/StartupScripts/../AzSharedAlcAssemblies'.
DEBUG: AssemblyLoadContext registered.
Connect-AzAccount: The term 'Connect-AzAccount' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
```

### Environment data

```PowerShell
$PSVersionTable

Name Value
---- -----
PSVersion 7.2.2
PSEdition Core
GitCommitId 7.2.2
OS Linux 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```

### Module versions

```PowerShell
Get-Module Az*

ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.8.0 Az.Accounts
```

### Error output

```PowerShell
I do not have this command
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported command with Az.Accounts 2.8.0 and compare command availability with version 2.7.6 in PowerShell 7.2.2. Trace how the module is installed and loaded, then verify that Connect-AzAccount is recognized and the reported access-token invocation works with the affected version.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, powershell
Domain
authentication, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.