Azure / Azure/azure-powershell
Az.Accounts slow import over networked I/O (Azure Functions)
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 51
Description
### Description
In the Azure Functions environment, we have reports from customers of the Az.Accounts module taking 5 or more seconds to import. Our current theory is that this is primarily due to the PSModulePath being stored on network from the Functions VM and slow I/O leads to longer import times for this module (and likely other large modules with many files).
Note that the Issue Script & Debug output field, as well as the other fields in this bug report, were ran locally. To repro this issue most effectively, this command should be run in the Azure Functions environment, or simulated using networked storage with limited IOPS
### Issue script & Debug output
```PowerShell
Measure-Command { Import-Module Az.Accounts }
Days : 0
Hours : 0
Minutes : 0
Seconds : 2
Milliseconds : 362
Ticks : 23625645
TotalDays : 2.73444965277778E-05
TotalHours : 0.000656267916666667
TotalMinutes : 0.039376075
TotalSeconds : 2.3625645
TotalMilliseconds : 2362.5645
```
### Environment data
```PowerShell
Name Value
---- -----
PSVersion 7.4.3
PSEdition Core
GitCommitId 7.4.3
OS Microsoft Windows 10.0.22631
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
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.13.2 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzConte…
```
### Error output
```PowerShell
DEBUG: Got version 0 of Az
DEBUG: Got version 0 of Az.Accounts
DEBUG: 10:38:56 AM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 10:38:56 AM - using account id 'andystaples@microsoft.com'...
DEBUG: 10:38:56 AM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:38:56 AM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:38:56 AM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
WARNING: You're using Az version 11.0.0. The latest version of Az is 11.2.0. Upgrade your Az modules using the following commands:
Update-PSResource Az -WhatIf -- Simulate updating your Az modules.
Update-PSResource Az -- Update your Az modules.
DEBUG: AzureQoSEvent: Module: Az.Accounts:2.13.2; CommandName: Resolve-AzError; PSVersion: 7.4.3; IsSuccess: True; Duration: 00:00:01.3343702
DEBUG: 10:38:57 AM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:38:57 AM - ResolveError end processing.
```
Contributor guide
Assessment
This issue has not been assessed yet.