Azure / Azure/azure-powershell
Connect-AzAccount -MaxContextPopulation not working when called with existing contexts
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 51
Description
## Description
`Connect-AzAccount -MaxContextPopulation` not working when called with existing contexts.
## Steps to reproduce
First delete `~/.azure`.
```powershell
> Connect-AzAccount
# Returned 1 item in total
> Get-AzContext -ListAvailable
# Returned 25 items in total
> Connect-AzAccount -MaxContextPopulation 100
# Returned 1 item in total
> Get-AzContext -ListAvailable
# Still returned 25 items in total
```
## Environment data
```powershell
> $PSVersionTable
Name Value
---- -----
PSVersion 7.1.0
PSEdition Core
GitCommitId 7.1.0
OS Microsoft Windows 10.0.19042
Platform Win32NT
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 -ListAvailable
Directory: C:\Users\xxx\Documents\PowerShell\Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Script 5.6.0 Az Core,Desk
Script 2.2.6 Az.Accounts Core,Desk {Disable-AzDataCollection, Disable-AzCo…
```
Contributor guide
Assessment
This issue has not been assessed yet.