PowerShell unable to load Az.Resources module
See original GitHub issueSystem Details
- macOS Catalina 10.15.1
- VSCode version 1.41.0-insider
- PowerShell extension version ms-vscode.powershell-preview 2019.11.0
System Details Output
### PSES version: 2.0.0.0
### PowerShell version:
Name Value
---- -----
PSVersion 6.2.3
PSEdition Core
GitCommitId 6.2.3
OS Darwin 19.0.0 Darwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT 2019; root:xnu-6153.41.3~29/RELEASE_X86_64
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Issue Description
I am trying to run a PowerShell script that uses the Az.Resources module to export info from Azure AD. This script has worked in the past, and I believe the problems started after I upgraded to macOS Catalina.
I’ve pasted in the script below and also the output.
Script:
# this exports users from Azure AD into a csv file format specified by Tableau for importing users into Tableau Server
# created by chip@montage.co.nz
# last modified 2019-10-16
# retrieve the object id for the nelson Office Azure AD security group
Get-AzADGroup -DisplayName "Nelson Office"
# retrieve all users belonging to the NO security group
$users = Get-AzADGroupMember -GroupObjectId "0bbfc2a1-e862-49f9-9745-c3d82a62cd5b"
# create custom objects for each user with the properties required by Tableau Server for importing users
$userArray = @()
foreach ($user in $users) {
$properties = @{'UserName' = $user.UserPrincipalName;
'Password' = 'password'
'DisplayName' = $user.DisplayName;
'LicenseLevel' = '';
'AdminitratorLevel' = '';
'PublishingCapability' = '';
'Email' = $user.UserPrincipalName}
$userArray += New-Object –TypeName PSObject –Prop $properties
}
# output to csv
$userArray | Select-Object -Property UserName, Password, DisplayName, LicenseLevel, AdminitratorLevel, PublishingCapability, Email |
ConvertTo-Csv | Set-Content -Path ./azure-ad-users.csv
# strip out text qualifiers from the csv and also the header row and re-save file
(Get-Content -Path ./azure-ad-users.csv).Replace('"','') | Select-Object -Skip 1 | Set-Content -Path ./azure-ad-users.csv
# display results
Get-Content -Path ./azure-ad-users.csv#### Expected Behaviour
Output:
PowerShell Integrated Console
PS /Users/chip/Dropbox/Code/Powershell> Unable to find type [Microsoft.PowerShell.PSConsoleReadLine].
At line:1 char:71
+ ... :RunClassConstructor([Microsoft.PowerShell.PSConsoleReadLine].TypeHan ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.PowerShell.PSConsoleReadLine:TypeName) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
PS /Users/chip/Dropbox/Code/Powershell> /Users/chip/Dropbox/Code/Powershell/export-azure-ad-users.ps1
Get-AzADGroup : The 'Get-AzADGroup' command was found in the module 'Az.Resources', but the module could not be loaded. For more information, run 'Import-Module Az.Resources'.
At /Users/chip/Dropbox/Code/Powershell/export-azure-ad-users.ps1:6 char:1
+ Get-AzADGroup -DisplayName "Nelson Office"
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-AzADGroup:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Get-AzADGroupMember : The 'Get-AzADGroupMember' command was found in the module 'Az.Resources', but the module could not be loaded. For more information, run 'Import-Module Az.Resources'.
At /Users/chip/Dropbox/Code/Powershell/export-azure-ad-users.ps1:9 char:10
+ $users = Get-AzADGroupMember -GroupObjectId "0bbfc2a1-e862-49f9-9745- ...
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-AzADGroupMember:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
krupesh.desai@montage.co.nz,password,Krupesh Desai,,,,krupesh.desai@montage.co.nz
PS> ./export-azure-ad-users.ps1
Get-AzADGroup : The 'Get-AzADGroup' command was found in the module 'Az.Resources', but the module could not be loaded. For more information, run 'Import-Module Az.Resources'.
At /Users/chip/Dropbox/Code/Powershell/export-azure-ad-users.ps1:6 char:1
+ Get-AzADGroup -DisplayName "Nelson Office"
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-AzADGroup:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Get-AzADGroupMember : The 'Get-AzADGroupMember' command was found in the module 'Az.Resources', but the module could not be loaded. For more information, run 'Import-Module Az.Resources'.
At /Users/chip/Dropbox/Code/Powershell/export-azure-ad-users.ps1:9 char:10
+ $users = Get-AzADGroupMember -GroupObjectId "0bbfc2a1-e862-49f9-9745- ...
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-AzADGroupMember:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
krupesh.desai@montage.co.nz,password,Krupesh Desai,,,,krupesh.desai@montage.co.nz
ersion: $($pseditor.EditorServicesVersion)"; "`n### PowerShell version:`n$($PSVersionTable | Out-String)"}ions:`n$(code-insiders --list-extensions --show-versions | Out-String)"; "`n### PSES v
code-insiders : The term 'code-insiders' 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.
At line:1 char:27
+ & {"### VSCode version: $(code-insiders -v)"; "`n### VSCode extension ...
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (code-insiders:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
### VSCode version:
code-insiders : The term 'code-insiders' 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.
At line:1 char:76
+ ... ode-insiders -v)"; "`n### VSCode extensions:`n$(code-insiders --list- ...
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (code-insiders:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
VSCode extensions:
PSES version: 2.0.0.0
PowerShell version:
Name Value
PSVersion 6.2.3 PSEdition Core GitCommitId 6.2.3 OS Darwin 19.0.0 Darwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT 2019; root:xnu-6153.41.3~29/RELEASE_X86_64 Platform Unix PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0
PS /Users/chip/Dropbox/Code/Powershell> Unable to find type [Microsoft.PowerShell.PSConsoleReadLine]. At line:1 char:71
- … :RunClassConstructor([Microsoft.PowerShell.PSConsoleReadLine].TypeHan …
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - CategoryInfo : InvalidOperation: (Microsoft.PowerShell.PSConsoleReadLine:TypeName) [], RuntimeException
- FullyQualifiedErrorId : TypeNotFound
PS /Users/chip/Dropbox/Code/Powershell> /Users/chip/Dropbox/Code/Powershell/export-azure-ad-users.ps1
Get-AzADGroup : The ‘Get-AzADGroup’ command was found in the module ‘Az.Resources’, but the module could not be loaded. For more information, run ‘Import-Module Az.Resources’. At /Users/chip/Dropbox/Code/Powershell/export-azure-ad-users.ps1:6 char:1
- Get-AzADGroup -DisplayName “Nelson Office”
-
- CategoryInfo : ObjectNotFound: (Get-AzADGroup:String) [], CommandNotFoundException
- FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Get-AzADGroupMember : The ‘Get-AzADGroupMember’ command was found in the module ‘Az.Resources’, but the module could not be loaded. For more information, run ‘Import-Module Az.Resources’. At /Users/chip/Dropbox/Code/Powershell/export-azure-ad-users.ps1:9 char:10
- $users = Get-AzADGroupMember -GroupObjectId "0bbfc2a1-e862-49f9-9745- …
-
~~~~~~~~~~~~~~~~~~~ - CategoryInfo : ObjectNotFound: (Get-AzADGroupMember:String) [], CommandNotFoundException
- FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Attached Logs
I’ve attached the powershell and editor services logs: Archive.zip
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (1 by maintainers)

Top Related StackOverflow Question
I am seeing one issue with your fix though. When the Powershell integrated console starts up in Visual Studio, I get the error below:
This issue has been marked as duplicate and has not had any activity for 1 day. It has been closed for housekeeping purposes.