Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.21k stars 3.81k forks source link

Az.Tools.Installer - Update-AzModules will not replace old Az module versions if run in VSCode integrated terminal #23999

Open lgabor85 opened 7 months ago

lgabor85 commented 7 months ago

Description

As discussed here, the cmdlet Update-AzModule will install the latest Az modules but not remove older versions when it is run in a VSCode integrated terminal, even if run with admin privileges.

If run in a separate, elevated windows terminal, the cmdlet executes as expected and replaces the old versions with the latest.

Issue script & Debug output

# this is the issue as seen in the VSCode terminal.
# Verifying that we are elevated
PS D:\Repos> $isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')
PS D:\Repos> $isAdmin
True

# Running the cmdlet with -Debug parameter
PS D:\Repos> Update-AzModule -Scope CurrentUser -Repository PSGallery -Debug
DEBUG: Powershell Core Version 7.3.10
DEBUG: [Update-AzModule] 85 module(s) are found.
DEBUG: [Update-AzModule] Az.Advisor Az.AnalysisServices Az.ApiManagement Az.App Az.AppConfiguration Az.ArcResourceBridge Az.Attestation Az.Automanage Az.Batch Az.Billing Az.Cdn Az.ConfidentialLedger Az.DataBoxEdge Az.DataLakeAnalytics Az.DataLakeStore Az.DataShare Az.DeploymentManager Az.DevCenter Az.DevTestLabs Az.EventGrid Az.FrontDoor Az.HealthcareApis Az.IotHub Az.LoadTesting Az.LogicApp Az.MachineLearning Az.MachineLearningServices Az.ManagedServices Az.MarketplaceOrdering Az.Media Az.Migrate Az.MySql Az.NetworkCloud Az.NotificationHubs Az.OperationalInsights Az.PostgreSql Az.PrivateDns Az.RedisEnterpriseCache Az.Relay Az.ResourceMover Az.ServiceBus Az.SignalR Az.SqlVirtualMachine Az.StreamAnalytics Az.Support are already in their latest version(s) with reference to PSGallery.

Remove                                                                                                   
Az                                                                                                       
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): a                
DEBUG: [Update-AzModule] Will update Az.Accounts Az.Aks Az.ApplicationInsights Az.Automation Az.CloudService Az.CognitiveServices Az.Compute Az.ContainerInstance Az.ContainerRegistry Az.CosmosDB Az.Databricks Az.DataFactory Az.DataProtection Az.DesktopVirtualization Az.Dns Az.EventHub Az.Functions Az.HDInsight Az.KeyVault Az.Kusto Az.Maintenance Az.ManagedServiceIdentity Az.Monitor Az.Network Az.PolicyInsights Az.PowerBIEmbedded Az.RecoveryServices Az.RedisCache Az.Resources Az.Security Az.SecurityInsights Az.ServiceFabric Az.Sql Az.StackHCI Az.Storage Az.StorageMover Az.StorageSync Az.Synapse Az.TrafficManager Az.Websites to the latest version(s) on PSGallery.
DEBUG: [Update-AzModule] The repository folder C:\Users\'UserName'\AppData\Local\Temp\f8305c1f-3ad8-4368-96dd-c941394c6ef6 is created.
DEBUG: [Update-AzModule] The temporary repository AzTempRepo is registered.
DEBUG: [Update-AzModule] Downloading Az.Accounts version 2.15.0.                                         
DEBUG: [Update-AzModule] Downloading Az.Aks version 6.0.0.
DEBUG: [Update-AzModule] Downloading Az.ApplicationInsights version 2.2.3.                               
DEBUG: [Update-AzModule] Downloading Az.Automation version 1.10.0.                                       
DEBUG: [Update-AzModule] Downloading Az.CloudService version 2.0.0.                                      
DEBUG: [Update-AzModule] Downloading Az.CognitiveServices version 1.14.1.                                
DEBUG: [Update-AzModule] Downloading Az.Compute version 7.1.1.                                           
DEBUG: [Update-AzModule] Downloading Az.ContainerInstance version 4.0.0.                                 
DEBUG: [Update-AzModule] Downloading Az.ContainerRegistry version 4.1.3.                                 
DEBUG: [Update-AzModule] Downloading Az.CosmosDB version 1.14.0.                                         
DEBUG: [Update-AzModule] Downloading Az.Databricks version 1.7.1.                                        
DEBUG: [Update-AzModule] Downloading Az.DataFactory version 1.18.0.                                      
DEBUG: [Update-AzModule] Downloading Az.DataProtection version 2.2.0.
DEBUG: [Update-AzModule] Downloading Az.DesktopVirtualization version 4.3.0.                             
DEBUG: [Update-AzModule] Downloading Az.Dns version 1.2.0.                                               
DEBUG: [Update-AzModule] Downloading Az.EventHub version 4.2.0.
DEBUG: [Update-AzModule] Downloading Az.Functions version 4.0.7.                                         
DEBUG: [Update-AzModule] Downloading Az.HDInsight version 6.1.0.                                         
DEBUG: [Update-AzModule] Downloading Az.KeyVault version 5.1.0.
DEBUG: [Update-AzModule] Downloading Az.Kusto version 2.3.0.                                             
DEBUG: [Update-AzModule] Downloading Az.Maintenance version 1.4.1.                                       
DEBUG: [Update-AzModule] Downloading Az.ManagedServiceIdentity version 1.2.0.                            
DEBUG: [Update-AzModule] Downloading Az.Monitor version 5.0.0.                                           
DEBUG: [Update-AzModule] Downloading Az.Network version 7.3.0.                                           
DEBUG: [Update-AzModule] Downloading Az.PolicyInsights version 1.6.4.
DEBUG: [Update-AzModule] Downloading Az.PowerBIEmbedded version 2.0.0.                                   
DEBUG: [Update-AzModule] Downloading Az.RecoveryServices version 6.7.0.                                  
DEBUG: [Update-AzModule] Downloading Az.RedisCache version 1.8.1.                                        
DEBUG: [Update-AzModule] Downloading Az.Resources version 6.13.0.                                        
DEBUG: [Update-AzModule] Downloading Az.Security version 1.5.1.
DEBUG: [Update-AzModule] Downloading Az.SecurityInsights version 3.1.1.                                  
DEBUG: [Update-AzModule] Downloading Az.ServiceFabric version 3.3.2.                                     
DEBUG: [Update-AzModule] Downloading Az.Sql version 4.13.0.                                              
DEBUG: [Update-AzModule] Downloading Az.StackHCI version 2.2.3.                                          
DEBUG: [Update-AzModule] Downloading Az.Storage version 6.1.0.
DEBUG: [Update-AzModule] Downloading Az.StorageMover version 1.3.0.                                      
DEBUG: [Update-AzModule] Downloading Az.StorageSync version 2.1.1.                                       
DEBUG: [Update-AzModule] Downloading Az.Synapse version 3.0.5.                                           
DEBUG: [Update-AzModule] Downloading Az.TrafficManager version 1.2.2.                                    
DEBUG: [Update-AzModule] Downloading Az.Websites version 3.1.2.
DEBUG: [Update-AzModule] All download tasks are finished. Time Elapsed Total:2.1042445s.
DEBUG: [Update-AzModule] Will install modules Az.Accounts Az.Aks Az.ApplicationInsights Az.Automation Az.CloudService Az.CognitiveServices Az.Compute Az.ContainerInstance Az.ContainerRegistry Az.CosmosDB Az.Databricks Az.DataFactory Az.DataProtection Az.DesktopVirtualization Az.Dns Az.EventHub Az.Functions Az.HDInsight Az.KeyVault Az.Kusto Az.Maintenance Az.ManagedServiceIdentity Az.Monitor Az.Network Az.PolicyInsights Az.PowerBIEmbedded Az.RecoveryServices Az.RedisCache Az.Resources Az.Security Az.SecurityInsights Az.ServiceFabric Az.Sql Az.StackHCI Az.Storage Az.StorageMover Az.StorageSync Az.Synapse Az.TrafficManager Az.Websites.
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Accounts\2.15.0\PSGetModuleInfo.xml                                                                             
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Accounts\2.15.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.Aks of version 6.0.0 is complete.
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Aks\6.0.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Aks\6.0.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.ApplicationInsights of version 2.2.3 is complete.                 
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.ApplicationInsights\2.2.3\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.ApplicationInsights\2.2.3\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.Automation of version 1.10.0 is complete.
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Automation\1.10.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Automation\1.10.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.CloudService of version 2.0.0 is complete.                        
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.CloudService\2.0.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.CloudService\2.0.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.CognitiveServices of version 1.14.1 is complete.                  
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.CognitiveServices\1.14.1\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.CognitiveServices\1.14.1\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.Compute of version 7.1.1 is complete.                             
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Compute\7.1.1\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Compute\7.1.1\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.ContainerInstance of version 4.0.0 is complete.
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.ContainerInstance\4.0.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.ContainerInstance\4.0.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.ContainerRegistry of version 4.1.3 is complete.
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.ContainerRegistry\4.1.3\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.ContainerRegistry\4.1.3\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.CosmosDB of version 1.14.0 is complete.
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.CosmosDB\1.14.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.CosmosDB\1.14.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.Databricks of version 1.7.1 is complete.                          
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Databricks\1.7.1\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Databricks\1.7.1\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.DataFactory of version 1.18.0 is complete.                        
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.DataFactory\1.18.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.DataFactory\1.18.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.DataProtection of version 2.2.0 is complete.                      
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.DataProtection\2.2.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.DataProtection\2.2.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.DesktopVirtualization of version 4.3.0 is complete.               
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.DesktopVirtualization\4.3.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.DesktopVirtualization\4.3.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.Dns of version 1.2.0 is complete.                                 
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Dns\1.2.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Dns\1.2.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.EventHub of version 4.2.0 is complete.
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.EventHub\4.2.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.EventHub\4.2.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.Functions of version 4.0.7 is complete.
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Functions\4.0.7\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Functions\4.0.7\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.HDInsight of version 6.1.0 is complete.                           
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.HDInsight\6.1.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.HDInsight\6.1.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.KeyVault of version 5.1.0 is complete.
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.KeyVault\5.1.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.KeyVault\5.1.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.Kusto of version 2.3.0 is complete.
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Kusto\2.3.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Kusto\2.3.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.Maintenance of version 1.4.1 is complete.
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Maintenance\1.4.1\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Maintenance\1.4.1\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.ManagedServiceIdentity of version 1.2.0 is complete.              
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.ManagedServiceIdentity\1.2.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.ManagedServiceIdentity\1.2.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.Monitor of version 5.0.0 is complete.                             
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Monitor\5.0.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Monitor\5.0.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.Network of version 7.3.0 is complete.                             
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Network\7.3.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Network\7.3.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.PolicyInsights of version 1.6.4 is complete.                      
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.PolicyInsights\1.6.4\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.PolicyInsights\1.6.4\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.PowerBIEmbedded of version 2.0.0 is complete.                     
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.PowerBIEmbedded\2.0.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.PowerBIEmbedded\2.0.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.RecoveryServices of version 6.7.0 is complete.                    
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.RecoveryServices\6.7.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.RecoveryServices\6.7.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.RedisCache of version 1.8.1 is complete.                          
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.RedisCache\1.8.1\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.RedisCache\1.8.1\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.Resources of version 6.13.0 is complete.                          
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Resources\6.13.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Resources\6.13.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.Security of version 1.5.1 is complete.                            
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Security\1.5.1\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Security\1.5.1\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.SecurityInsights of version 3.1.1 is complete.                    
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.SecurityInsights\3.1.1\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.SecurityInsights\3.1.1\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.ServiceFabric of version 3.3.2 is complete.                       
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.ServiceFabric\3.3.2\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.ServiceFabric\3.3.2\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.Sql of version 4.13.0 is complete.                                
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Sql\4.13.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Sql\4.13.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.StackHCI of version 2.2.3 is complete.                            
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.StackHCI\2.2.3\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.StackHCI\2.2.3\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.Storage of version 6.1.0 is complete.                             
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Storage\6.1.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Storage\6.1.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.StorageMover of version 1.3.0 is complete.                        
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.StorageMover\1.3.0\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.StorageMover\1.3.0\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.StorageSync of version 2.1.1 is complete.                         
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.StorageSync\2.1.1\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.StorageSync\2.1.1\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.Synapse of version 3.0.5 is complete.                             
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Synapse\3.0.5\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Synapse\3.0.5\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.TrafficManager of version 1.2.2 is complete.                      
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.TrafficManager\1.2.2\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.TrafficManager\1.2.2\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] Installing Az.Websites of version 3.1.2 is complete.                            
DEBUG: Checking file: C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Websites\3.1.2\PSGetModuleInfo.xml
DEBUG: Write new xml to C:\Users\'UserName'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules\Az.Websites\3.1.2\PSGetModuleInfo.xml
DEBUG: [Update-AzModule] All installing tasks are completed; Time Elapsed Total: 162.8646215s.           
DEBUG: [Update-AzModule] The temporary repository AzTempRepo is unregistered.                            
DEBUG: [Update-AzModule] The Repository folder C:\Users\GaborLakatos\AppData\Local\Temp\f8305c1f-3ad8-4368-96dd-c941394c6ef6 is removed.
DEBUG: Initialize telemetry client
DEBUG: Finish sending metric

# Running a custom module in order to see if there are any duplicate/previous versions left over
PS D:\Repos> Import-Module .\getDuplicateAzModules.psm1
PS D:\Repos> Get-DuplicateAzModules

Name                      Version
----                      -------
Az.Accounts               {2.15.0, 2.13.1}
Az.Aks                    {6.0.0, 5.5.1}
Az.ApplicationInsights    {2.2.3, 2.2.2}
Az.Automation             {1.10.0, 1.9.1}
Az.CloudService           {2.0.0, 1.2.0}
Az.CognitiveServices      {1.14.1, 1.14.0}
Az.Compute                {7.1.1, 6.3.0}
Az.ContainerInstance      {4.0.0, 3.2.2}
Az.ContainerRegistry      {4.1.3, 4.1.1}
Az.CosmosDB               {1.14.0, 1.12.0}
Az.Databricks             {1.7.1, 1.7.0}
Az.DataFactory            {1.18.0, 1.17.0}
Az.DataProtection         {2.2.0, 2.1.0}
Az.DesktopVirtualization  {4.3.0, 4.0.0}
Az.Dns                    {1.2.0, 1.1.3}
Az.EventHub               {4.2.0, 4.1.0}
Az.Functions              {4.0.7, 4.0.6}
Az.HDInsight              {6.1.0, 6.0.1}
Az.KeyVault               {5.1.0, 4.12.0}
Az.Kusto                  {2.3.0, 2.2.0}
Az.Maintenance            {1.4.1, 1.3.1}
Az.ManagedServiceIdentity {1.2.0, 1.1.1}
Az.Monitor                {5.0.0, 4.6.0}
Az.Network                {7.3.0, 6.2.0}
Az.PolicyInsights         {1.6.4, 1.6.3}
Az.PowerBIEmbedded        {2.0.0, 1.2.1}
Az.RecoveryServices       {6.7.0, 6.6.0}
Az.RedisCache             {1.8.1, 1.8.0}
Az.Resources              {6.13.0, 6.11.1}
Az.Security               {1.5.1, 1.4.0}
Az.SecurityInsights       {3.1.1, 3.1.0}
Az.ServiceFabric          {3.3.2, 3.2.0}
Az.Sql                    {4.13.0, 4.10.0}
Az.StackHCI               {2.2.3, 2.2.0}
Az.Storage                {6.1.0, 5.10.1}
Az.StorageMover           {1.3.0, 1.0.1}
Az.StorageSync            {2.1.1, 2.0.0}
Az.Synapse                {3.0.5, 3.0.3}
Az.TrafficManager         {1.2.2, 1.2.1}
Az.Websites               {3.1.2, 3.1.1}
Az.Accounts               {2.15.0, 2.13.1}
Az.Aks                    {6.0.0, 5.5.1}
Az.ApplicationInsights    {2.2.3, 2.2.2}
Az.Automation             {1.10.0, 1.9.1}
Az.CloudService           {2.0.0, 1.2.0}
Az.CognitiveServices      {1.14.1, 1.14.0}
Az.Compute                {7.1.1, 6.3.0}
Az.ContainerInstance      {4.0.0, 3.2.2}
Az.ContainerRegistry      {4.1.3, 4.1.1}
Az.CosmosDB               {1.14.0, 1.12.0}
Az.Databricks             {1.7.1, 1.7.0}
Az.DataFactory            {1.18.0, 1.17.0}
Az.DataProtection         {2.2.0, 2.1.0}
Az.DesktopVirtualization  {4.3.0, 4.0.0}
Az.Dns                    {1.2.0, 1.1.3}
Az.EventHub               {4.2.0, 4.1.0}
Az.Functions              {4.0.7, 4.0.6}
Az.HDInsight              {6.1.0, 6.0.1}
Az.KeyVault               {5.1.0, 4.12.0}
Az.Kusto                  {2.3.0, 2.2.0}
Az.Maintenance            {1.4.1, 1.3.1}
Az.ManagedServiceIdentity {1.2.0, 1.1.1}
Az.Monitor                {5.0.0, 4.6.0}
Az.Network                {7.3.0, 6.2.0}
Az.PolicyInsights         {1.6.4, 1.6.3}
Az.PowerBIEmbedded        {2.0.0, 1.2.1}
Az.RecoveryServices       {6.7.0, 6.6.0}
Az.RedisCache             {1.8.1, 1.8.0}
Az.Resources              {6.13.0, 6.11.1}
Az.Security               {1.5.1, 1.4.0}
Az.SecurityInsights       {3.1.1, 3.1.0}
Az.ServiceFabric          {3.3.2, 3.2.0}
Az.Sql                    {4.13.0, 4.10.0}
Az.StackHCI               {2.2.3, 2.2.0}
Az.Storage                {6.1.0, 5.10.1}
Az.StorageMover           {1.3.0, 1.0.1}
Az.StorageSync            {2.1.1, 2.0.0}
Az.Synapse                {3.0.5, 3.0.3}
Az.TrafficManager         {1.2.2, 1.2.1}
Az.Websites               {3.1.2, 3.1.1}

# To double check, simply running 'Get-Module' to retrieve a random Az module from the list
PS D:\Repos> Get-Module -Name Az.Websites -ListAvailable

    Directory: C:\Users\'UserName'\OneDrive - ASAPCLOUD\Documenten\PowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     3.1.2                 Az.Websites                         Core,Desk {Get-AzAppServicePlan, Set-AzAppServicePl…

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     3.1.1                 Az.Websites                         Core,Desk {Get-AzAppServicePlan, Set-AzAppServicePl…

Environment data

PS D:\Repos> $PSVersionTable.PSVersion

Major  Minor  Patch  PreReleaseLabel BuildLabel
-----  -----  -----  --------------- ----------
7      3      10

Module versions

PS D:\Repos> Get-Module -Name Az* -ListAvailable

    Directory: C:\Users\'MyUser'\OneDrive - 'CompnayDir'\Documents\PowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     2.15.0                Az.Accounts                         Core,Desk {Disable-AzDataCollectio… 
Script     6.0.0                 Az.Aks                              Core,Desk {Get-AzAksCluster, New-A… 
Script     1.0.0                 Az.App                              Core,Desk {Disable-AzContainerAppR… 
Script     2.2.3                 Az.ApplicationInsights              Core,Desk {Get-AzApplicationInsigh… 
Script     1.10.0                Az.Automation                       Core,Desk {Export-AzAutomationDscC… 
Script     2.0.0                 Az.CloudService                     Core,Desk {Get-AzCloudService, Get… 
Script     1.14.1                Az.CognitiveServices                Core,Desk {Get-AzCognitiveServices… 
Script     7.1.1                 Az.Compute                          Core,Desk {Add-AzImageDataDisk, Ad…
Script     4.0.0                 Az.ContainerInstance                Core,Desk {Add-AzContainerInstance… 
Script     4.1.3                 Az.ContainerRegistry                Core,Desk {Connect-AzContainerRegi… 
Script     1.14.0                Az.CosmosDB                         Core,Desk {Get-AzCosmosDBAccount, …
Script     1.7.1                 Az.Databricks                       Core,Desk {Get-AzDatabricksAccessC…
Script     1.18.0                Az.DataFactory                      Core,Desk {Set-AzDataFactoryV2, Up… 
Script     2.2.0                 Az.DataProtection                   Core,Desk {Backup-AzDataProtection… 
Script     4.3.0                 Az.DesktopVirtualization            Core,Desk {Disconnect-AzWvdUserSes…
Script     1.1.0                 Az.DevCenter                        Core,Desk {Deploy-AzDevCenterUserE… 
Script     1.2.0                 Az.Dns                              Core,Desk {Get-AzDnsRecordSet, New… 
Script     4.2.0                 Az.EventHub                         Core,Desk {New-AzEventHubAuthoriza… 
Script     4.0.7                 Az.Functions                        Core,Desk {Get-AzFunctionApp, Get-…
Script     6.1.0                 Az.HDInsight                        Core,Desk {Add-AzHDInsightClusterI… 
Script     5.1.0                 Az.KeyVault                         Core,Desk {Add-AzKeyVaultCertifica… 
Script     2.3.0                 Az.Kusto                            Core,Desk {Add-AzKustoClusterLangu… 
Script     1.4.1                 Az.Maintenance                      Core,Desk {Get-AzApplyUpdate, Get-… 
Script     1.2.0                 Az.ManagedServiceIdentity           Core,Desk {Get-AzSystemAssignedIde…
Script     5.0.0                 Az.Monitor                          Core,Desk {Get-AzMetricDefinition,… 
Script     7.3.0                 Az.Network                          Core,Desk {Add-AzApplicationGatewa… 
Script     1.0.0                 Az.NetworkCloud                     Core,Desk {Deploy-AzNetworkCloudCl… 
Script     1.6.4                 Az.PolicyInsights                   Core,Desk {Get-AzPolicyEvent, Get-… 
Script     2.0.0                 Az.PowerBIEmbedded                  Core,Desk {Resume-AzPowerBIEmbedde… 
Script     6.7.0                 Az.RecoveryServices                 Core,Desk {Add-AzRecoveryServicesA… 
Script     1.8.1                 Az.RedisCache                       Core,Desk {Remove-AzRedisCachePatc… 
Script     6.13.0                Az.Resources                        Core,Desk {Export-AzResourceGroup,… 
Script     1.5.1                 Az.Security                         Core,Desk {Get-AzSecuritySolution,…
Script     3.1.1                 Az.SecurityInsights                 Core,Desk {Get-AzSentinelAlertRule…
Script     3.3.2                 Az.ServiceFabric                    Core,Desk {Add-AzServiceFabricClie… 
Script     4.13.0                Az.Sql                              Core,Desk {Add-AzSqlDatabaseToFail… 
Script     2.2.3                 Az.StackHCI                         Core,Desk {Add-AzStackHCIVMAttesta… 
Script     6.1.0                 Az.Storage                          Core,Desk {Add-AzRmStorageContaine… 
Script     1.3.0                 Az.StorageMover                     Core,Desk {Get-AzStorageMover, Get… 
Script     2.1.1                 Az.StorageSync                      Core,Desk {Get-AzStorageSyncCloudE…
Script     3.0.5                 Az.Synapse                          Core,Desk {Add-AzSynapseDataFlowDe… 
Script     1.0.0                 Az.Tools.Installer                  Core,Desk {Install-AzModule, Unins… 
Script     1.2.2                 Az.TrafficManager                   Core,Desk {Add-AzTrafficManagerCus… 
Script     3.1.2                 Az.Websites                         Core,Desk {Get-AzAppServicePlan, S… 

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     2.0.0                 Az.Advisor                          Core,Desk {Disable-AzAdvisorRecomm… 
Script     1.1.4                 Az.AnalysisServices                 Core,Desk {Resume-AzAnalysisServic… 
Script     4.0.2                 Az.ApiManagement                    Core,Desk {Add-AzApiManagementApiT… 
Script     1.3.0                 Az.AppConfiguration                 Core,Desk {Get-AzAppConfigurationS… 
Script     1.0.0                 Az.ArcResourceBridge                Core,Desk {Get-AzArcResourceBridge…
Script     2.0.0                 Az.Attestation                      Core,Desk {Get-AzAttestationPolicy… 
Script     1.0.0                 Az.Automanage                       Core,Desk {Get-AzAutomanageBestPra… 
Script     3.5.0                 Az.Batch                            Core,Desk {Remove-AzBatchAccount, …
Script     2.0.3                 Az.Billing                          Core,Desk {Get-AzBillingInvoice, G… 
Script     3.1.1                 Az.Cdn                              Core,Desk {Clear-AzCdnEndpointCont… 
Script     1.0.0                 Az.ConfidentialLedger               Core,Desk {Get-AzConfidentialLedge… 
Script     1.1.0                 Az.DataBoxEdge                      Core,Desk {Get-AzDataBoxEdgeJob, G…
Script     1.0.3                 Az.DataLakeAnalytics                Core,Desk {Get-AzDataLakeAnalytics… 
Script     1.3.0                 Az.DataLakeStore                    Core,Desk {Get-AzDataLakeStoreTrus… 
Script     1.0.1                 Az.DataShare                        Core,Desk {New-AzDataShareAccount,… 
Script     1.1.0                 Az.DeploymentManager                Core,Desk {Get-AzDeploymentManager… 
Script     1.0.2                 Az.DevTestLabs                      Core,Desk {Get-AzDtlAllowedVMSizes… 
Script     1.6.0                 Az.EventGrid                        Core,Desk {New-AzEventGridTopic, G… 
Script     1.10.0                Az.FrontDoor                        Core,Desk {New-AzFrontDoor, Get-Az…
Script     2.0.0                 Az.HealthcareApis                   Core,Desk {Get-AzHealthcareApisSer… 
Script     2.7.5                 Az.IotHub                           Core,Desk {Add-AzIotHubKey, Get-Az… 
Script     1.0.0                 Az.LoadTesting                      Core,Desk {Get-AzLoad, New-AzLoad,… 
Script     1.5.0                 Az.LogicApp                         Core,Desk {Get-AzIntegrationAccoun… 
Script     1.1.3                 Az.MachineLearning                  Core,Desk {Move-AzMlCommitmentAsso… 
Script     1.0.0                 Az.MachineLearningServices          Core,Desk {Get-AzMLServiceQuota, G… 
Script     3.0.0                 Az.ManagedServices                  Core,Desk {Get-AzManagedServicesAs… 
Script     2.0.0                 Az.MarketplaceOrdering              Core,Desk {Get-AzMarketplaceTerms,… 
Script     1.1.2                 Az.Media                            Core,Desk {Sync-AzMediaServiceStor… 
Script     2.2.0                 Az.Migrate                          Core,Desk {Get-AzMigrateDiscovered… 
Script     1.1.1                 Az.MySql                            Core,Desk {Get-AzMySqlConfiguratio…
Script     1.1.2                 Az.NotificationHubs                 Core,Desk {Get-AzNotificationHub, … 
Script     3.2.0                 Az.OperationalInsights              Core,Desk {New-AzOperationalInsigh… 
Script     1.1.0                 Az.PostgreSql                       Core,Desk {Get-AzPostgreSqlConfigu… 
Script     1.0.4                 Az.PrivateDns                       Core,Desk {Get-AzPrivateDnsZone, R… 
Script     1.2.0                 Az.RedisEnterpriseCache             Core,Desk {Export-AzRedisEnterpris… 
Script     2.0.0                 Az.Relay                            Core,Desk {Get-AzRelayAuthorizatio… 
Script     1.2.0                 Az.ResourceMover                    Core,Desk {Add-AzResourceMoverMove…
Script     3.0.0                 Az.ServiceBus                       Core,Desk {New-AzServiceBusAuthori… 
Script     2.0.0                 Az.SignalR                          Core,Desk {New-AzSignalR, Get-AzSi… 
Script     2.1.0                 Az.SqlVirtualMachine                Core,Desk {Get-AzAvailabilityGroup… 
Script     2.0.0                 Az.StreamAnalytics                  Core,Desk {Get-AzStreamAnalyticsCl… 
Script     1.0.0                 Az.Support                          Core,Desk {Get-AzSupportService, G… 
Script     1.0.0                 Az.Tools.Installer                  Core,Desk {Install-AzModule, Unins… 
Script     5.1.2                 Azure                               Desk      {Get-AzureAutomationCert… 
Manifest   0.5.0                 Azure.AnalysisServices              Desk      {Add-AzureAnalysisServic… 
Script     4.2.1                 Azure.Storage                       Desk      {Get-AzureStorageTable, … 
Script     5.7.0                 AzureRM                             Desk
Script     0.6.6                 AzureRM.AnalysisServices            Desk      {Resume-AzureRmAnalysisS…
Script     5.1.2                 AzureRM.ApiManagement               Desk      {Add-AzureRmApiManagemen… 
Script     0.1.3                 AzureRM.ApplicationInsights         Desk      {Get-AzureRmApplicationI… 
Script     4.3.2                 AzureRM.Automation                  Desk      {Get-AzureRMAutomationHy… 
Script     4.0.4                 AzureRM.Backup                      Desk      {Backup-AzureRmBackupIte… 
Script     4.0.6                 AzureRM.Batch                       Desk      {Remove-AzureRmBatchAcco…
Script     0.14.1                AzureRM.Billing                     Desk      {Get-AzureRmBillingInvoi… 
Script     4.2.2                 AzureRM.Cdn                         Desk      {Get-AzureRmCdnProfile, … 
Script     0.9.4                 AzureRM.CognitiveServices           Desk      {Get-AzureRmCognitiveSer… 
Script     4.6.0                 AzureRM.Compute                     Desk      {Remove-AzureRmAvailabil… 
Script     0.3.1                 AzureRM.Consumption                 Desk      Get-AzureRmConsumptionUs… 
Script     0.2.5                 AzureRM.ContainerInstance           Desk      {New-AzureRmContainerGro… 
Script     1.0.4                 AzureRM.ContainerRegistry           Desk      {New-AzureRmContainerReg… 
Script     4.2.2                 AzureRM.DataFactories               Desk      {Remove-AzureRmDataFacto… 
Script     0.5.3                 AzureRM.DataFactoryV2               Desk      {Set-AzureRmDataFactoryV… 
Script     4.2.3                 AzureRM.DataLakeAnalytics           Desk      {Get-AzureRmDataLakeAnal… 
Script     5.2.0                 AzureRM.DataLakeStore               Desk      {Get-AzureRmDataLakeStor… 
Script     4.0.4                 AzureRM.DevTestLabs                 Desk      {Get-AzureRmDtlAllowedVM… 
Script     4.1.2                 AzureRM.Dns                         Desk      {Get-AzureRmDnsRecordSet… 
Script     0.3.2                 AzureRM.EventGrid                   Desk      {New-AzureRmEventGridTop… 
Script     0.6.3                 AzureRM.EventHub                    Desk      {New-AzureRmEventHubName… 
Script     4.1.2                 AzureRM.HDInsight                   Desk      {Get-AzureRmHDInsightJob…
Script     4.0.4                 AzureRM.Insights                    Desk      {Get-AzureRmMetricDefini… 
Script     3.1.2                 AzureRM.IotHub                      Desk      {Add-AzureRmIotHubKey, G… 
Script     4.3.0                 AzureRM.KeyVault                    Desk      {Add-AzureKeyVaultCertif… 
Script     4.0.3                 AzureRM.LogicApp                    Desk      {Get-AzureRmIntegrationA… 
Script     0.17.2                AzureRM.MachineLearning             Desk      {Move-AzureRmMlCommitmen… 
Script     0.4.2                 AzureRM.MachineLearningCompute      Desk      {Get-AzureRmMlOpCluster,… 
Script     0.2.1                 AzureRM.MarketplaceOrdering         Desk      {Get-AzureRmMarketplaceT… 
Script     0.9.2                 AzureRM.Media                       Desk      {Sync-AzureRmMediaServic… 
Script     5.4.2                 AzureRM.Network                     Desk      {Add-AzureRmApplicationG… 
Script     4.1.1                 AzureRM.NotificationHubs            Desk      {Get-AzureRmNotification… 
Script     4.3.2                 AzureRM.OperationalInsights         Desk      {New-AzureRmOperationalI… 
Script     4.1.4                 AzureRM.PowerBIEmbedded             Desk      {Remove-AzureRmPowerBIWo…
Script     4.6.0                 AzureRM.Profile                     Desk      {Disable-AzureRmDataColl… 
Script     4.1.2                 AzureRM.RecoveryServices            Desk      {Get-AzureRmRecoveryServ… 
Script     4.1.2                 AzureRM.RecoveryServices.Backup     Desk      {Backup-AzureRmRecoveryS… 
Script     0.2.4                 AzureRM.RecoveryServices.SiteRecov… Desk      {Edit-AzureRmRecoverySer… 
Script     4.1.2                 AzureRM.RedisCache                  Desk      {Remove-AzureRmRedisCach… 
Script     0.3.3                 AzureRM.Relay                       Desk      {New-AzureRmRelayNamespa… 
Script     5.5.2                 AzureRM.Resources                   Desk      {Get-AzureRmProviderOper…
Script     0.16.3                AzureRM.Scheduler                   Desk      {Disable-AzureRmSchedule… 
Script     4.1.2                 AzureRM.ServerManagement            Desk      {Invoke-AzureRmServerMan… 
Script     0.6.4                 AzureRM.ServiceBus                  Desk      {New-AzureRmServiceBusNa… 
Script     0.3.4                 AzureRM.ServiceFabric               Desk      {Add-AzureRmServiceFabri… 
Script     5.0.6                 AzureRM.SiteRecovery                Desk      {Get-AzureRmSiteRecovery… 
Script     4.4.0                 AzureRM.Sql                         Desk      {Get-AzureRmSqlDatabaseT…
Script     4.2.3                 AzureRM.Storage                     Desk      {Get-AzureRmStorageAccou… 
Script     4.0.4                 AzureRM.StreamAnalytics             Desk      {Get-AzureRmStreamAnalyt… 
Script     4.0.1                 AzureRM.Tags                        Desk      {Remove-AzureRmTag, Get-… 
Script     4.0.3                 AzureRM.TrafficManager              Desk      {Disable-AzureRmTrafficM… 
Script     4.0.2                 AzureRM.UsageAggregates             Desk      Get-UsageAggregates       
Script     4.2.2                 AzureRM.Websites                    Desk      {Get-AzureRmAppServicePl…

Error output

N/A
isra-fel commented 7 months ago

Thanks for your feedback! @msJinLei please look into this issue. Thanks.

msJinLei commented 7 months ago

Hi @lgabor85 it is because you cannot uninstall modules in the path Directory: C:\Program Files\WindowsPowerShell\Modules from Powershell Core. These modules can only be uninstalled by windows Powershell. Try to start a windows Powershell terminal from vscode

ghost commented 7 months ago

Thanks for looking into it @msJinLei !

I tried another repro. Here is what I`ve done and the results:

1) Open an elevated WindowsPowershell terminal

PS C:\> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      22621  2506

PS C:\> $isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')
PS C:\> $isAdmin
True

1.1) Update the Az modules using cmdlet Update-AzModules

PS C:\> Update-AzModule -Name Az -WhatIf                                                              
WARNING: Az.Tools.Installer cannot be used to install Az. Will discard Az in the Name parameter.                        
What if: Remove Az if installed
WhatIf: Will update Az.Accounts from 2.15.0 to 2.15.1.
WhatIf: Will update Az.Aks from 6.0.0 to 6.0.1.
WhatIf: Will update Az.DataFactory from 1.18.0 to 1.18.1.
WhatIf: Will update Az.KeyVault from 5.1.0 to 5.2.0.                                                                    
WhatIf: Will update Az.Migrate from 2.2.0 to 2.3.0.                                                                     
WhatIf: Will update Az.Monitor from 5.0.0 to 5.0.1.                                                                     
WhatIf: Will update Az.Network from 7.3.0 to 7.4.0.                                                                     
WhatIf: Will update Az.RecoveryServices from 6.7.0 to 6.7.1.                                                            
WhatIf: Will update Az.Resources from 6.13.0 to 6.15.1.                                                                 
WhatIf: Will update Az.Sql from 4.13.0 to 4.14.0.                                                                       
WhatIf: Will update Az.SqlVirtualMachine from 2.1.0 to 2.2.0.                                                           
WhatIf: Will update Az.StackHCI from 2.2.3 to 2.3.0.
WhatIf: Will update Az.Storage from 6.1.0 to 6.1.1.
WhatIf: Will update Az.Websites from 3.1.2 to 3.2.0.   

PS C:\> Update-AzModule -Name Az                                                                      
WARNING: Az.Tools.Installer cannot be used to install Az. Will discard Az in the Name parameter.

Name                 VersionBeforeUpdate VersionUpdate
----                 ------------------- -------------
Az.Accounts          2.15.0              2.15.1
Az.Aks               6.0.0               6.0.1
Az.DataFactory       1.18.0              1.18.1
Az.KeyVault          5.1.0               5.2.0
Az.Migrate           2.2.0               2.3.0
Az.Monitor           5.0.0               5.0.1
Az.Network           7.3.0               7.4.0
Az.RecoveryServices  6.7.0               6.7.1
Az.Resources         6.13.0              6.15.1
Az.Sql               4.13.0              4.14.0
Az.SqlVirtualMachine 2.1.0               2.2.0
Az.StackHCI          2.2.3               2.3.0
Az.Storage           6.1.0               6.1.1
Az.Websites          3.1.2               3.2.0 

1.2) Pick a module and list its available versions

PS C:\> Get-Module -Name Az.Accounts -ListAvailable

    Directory: C:\Users\<USER>\OneDrive - <COMPANY>\Documenten\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     2.15.1     Az.Accounts                         {Disable-AzDataCollection, Disable-AzContextAutosave, Enab...

2) Repeat the same in PWSH7/Core

PS C:\> $PSVersionTable.PSVersion

Major  Minor  Patch  PreReleaseLabel BuildLabel
-----  -----  -----  --------------- ----------
7      3      11

PS C:\> $isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')
PS C:\> echo $isAdmin
True

PS C:\> Update-AzModule -Name Az -WhatIf
WARNING: Az.Tools.Installer cannot be used to install Az. Will discard Az in the Name parameter.
What if: Remove Az if installed
WhatIf: Will update Az.Accounts from 2.15.0 to 2.15.1.
WhatIf: Will update Az.Aks from 6.0.0 to 6.0.1.
WhatIf: Will update Az.DataFactory from 1.18.0 to 1.18.1.
WhatIf: Will update Az.KeyVault from 5.1.0 to 5.2.0.
WhatIf: Will update Az.Monitor from 5.0.0 to 5.0.1.
WhatIf: Will update Az.Network from 7.3.0 to 7.4.0.
WhatIf: Will update Az.RecoveryServices from 6.7.0 to 6.7.1.
WhatIf: Will update Az.Resources from 6.13.0 to 6.15.1.
WhatIf: Will update Az.Sql from 4.13.0 to 4.14.0.
WhatIf: Will update Az.StackHCI from 2.2.3 to 2.3.0.
WhatIf: Will update Az.Storage from 6.1.0 to 6.1.1.
WhatIf: Will update Az.Websites from 3.1.2 to 3.2.0.

PS C:\> Update-AzModule -Name Az
WARNING: Az.Tools.Installer cannot be used to install Az. Will discard Az in the Name parameter.
WARNING: The version '2.15.0' of module 'Az.Accounts' is currently in use. Retry the operation after closing the applications.
WARNING: The version '7.3.0' of module 'Az.Network' is currently in use. Retry the operation after closing the applications.
WARNING: The version '6.13.0' of module 'Az.Resources' is currently in use. Retry the operation after closing the applications.

Name                VersionBeforeUpdate VersionUpdate
----                ------------------- -------------
Az.Accounts         2.15.0              2.15.1
Az.Aks              6.0.0               6.0.1
Az.DataFactory      1.18.0              1.18.1
Az.KeyVault         5.1.0               5.2.0
Az.Monitor          5.0.0               5.0.1
Az.Network          7.3.0               7.4.0
Az.RecoveryServices 6.7.0               6.7.1
Az.Resources        6.13.0              6.15.1
Az.Sql              4.13.0              4.14.0
Az.StackHCI         2.2.3               2.3.0
Az.Storage          6.1.0               6.1.1
Az.Websites         3.1.2               3.2.0

PS C:\> Get-Module -Name Az.Accounts -ListAvailable

    Directory: C:\Users\<USER>\OneDrive - <COMPANY>\Documenten\PowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     2.15.1                Az.Accounts                         Core,Desk {Disable-AzDataCollection, Disable-AzCo…
Script     2.15.0                Az.Accounts                         Core,Desk {Disable-AzDataCollection, Disable-AzCo…

To me it looks like that the cmdlet doesn`t work properly in PWSH7/Core edition. Maybe it was related to me being logged in to my Azure account in VSCode PWSH at the time.