In this azure tutorial, we will discuss how to fix the error, The ‘New-AzSynapseWorkspace’ command was found in the module Az.Synapse’, but the module could not be loaded. which I got while trying to create an Azure Synapse Analytics Workspace using PowerShell in Azure.
Table of Contents
The ‘New-AzSynapseWorkspace’ command was found in the module Az.Synapse’, but the module could not be loaded
Recently, I was trying to execute the below Azure PowerShell script to create the Workspace, but I got the above error.
$SWN = 'BuildWP123'
$resourceGrp = 'test690'
$StorageAN ='testgact'
$SNFile4 = 'testfile'
$UserSQL = 'user123'
$PasswordSQL = 'Password123'
$Region = 'West US'
$TCred = New-Object -TypeName System.Management.Automation.PSCredential ($UserSQL, (ConvertTo-SecureString $PasswordSQL -AsPlainText -Force))
$wpParams = @{
Name = $SWN
ResourceGroupName = $resourceGrp
DefaultDataLakeStorageAccountName = $StorageAN
DefaultDataLakeStorageFilesystem = $SNFile4
SqlAdministratorLoginCredential = $TCred
Location = $Region
}
New-AzSynapseWorkspace @wpParams
After executing the above script, I got the below error.

Below is the complete error message that I got
New-AzSynapseWorkspace: The ‘New-AzSynapseWorkspace’ command was found in the module
‘Az.Synapse’, but the module could not be loaded. For more information, run
‘Import-Module Az.Synapse’.
At line:18 char:1
- New-AzSynapseWorkspace @wpParams
~~~~~~- CategoryInfo : ObjectNotFound: (New-AzSynapseWorkspace:String) [], Com
mandNotFoundException - FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
- CategoryInfo : ObjectNotFound: (New-AzSynapseWorkspace:String) [], Com
The ‘New-AzSynapseWorkspace’ command was found in the module Az.Synapse’, but the module could not be loaded [Solved]
To fix this error, I have followed the below steps.
- Run the below command to import the Az.Synapse
Import-Module Az.Synapse

But after running, the above Azure PowerShell cmd, I got the below error
” C:\Program Files\WindowsPowerShell\Modules\Az.Synapse\1.0.0\Az.Synapse.psm1 : This
module requires Az.Accounts version 2.7.1. An earlier version of Az.Accounts is
imported in the current PowerShell session. Please open a new session before
importing this module. This error could indicate that multiple incompatible versions
of the Azure PowerShell cmdlets are installed on your system. Please see
https://aka.ms/azps-version-error for troubleshooting information.
At line:1 char:1
- Import-Module Az.Synapse
~~~~~~~~- CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
- FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Az.Sy
napse.psm1
Import-Module : The module to process ‘Az.Synapse.psm1’, listed in field
‘NestedModules’ of module manifest ‘C:\Program
Files\WindowsPowerShell\Modules\Az.Synapse\1.0.0\Az.Synapse.psd1′ was not processed
because no valid module was found in any module directory.
At line:1 char:1
- Import-Module Az.Synapse
~~~~~~~~- CategoryInfo : ResourceUnavailable: (Az.Synapse:String) [Import-Module
], PSInvalidOperationException - FullyQualifiedErrorId : Modules_ModuleFileNotFound,Microsoft.PowerShell.Command
s.ImportModuleCommand “
- CategoryInfo : ResourceUnavailable: (Az.Synapse:String) [Import-Module
Now, to fix this issue I tried installing Az.Accounts version 2.7.1 using the below Azure PowerShell command.
Install-Module -Name Az.Accounts -RequiredVersion 2.7.1
Note: Before installing Az.Accounts version 2.7.1. Try using a new PowerShell session to import the Az.Synapse module.
Then I have opened one more session of PowerShell and tried importing the Az.Synapse module again using the below command
Import-Module Az.Synapse
This time it was executed successfully without any issue.

Then, I ran the Azure PowerShell script to create the Workspace again and this time it executed successfully, and the Azure Synapse Analytics Workspace got created without any issue.
You may also like following the below articles
- The ‘New-AzSqlServer’ command was found in the module ‘Az.Sql’, but the module could not be loaded
- The ‘New-AzResourceGroup’ command was found in the module ‘Az.Resources’
- No match was found for the specified search criteria and module names ‘AzTable’
- The specified module ‘ADSync’ was not loaded because no valid module file was found in any module directory error
Wrapping Up
In this article, we have discussed how to fix the error “The ‘New-AzSynapseWorkspace’ command was found in the module Az.Synapse’, but the module could not be loaded“. Hope it helped you to fix your issue as well.