I was trying to configure the TFS build for continuous deployment on Azure Cloud Services by following the steps mentioned in the documentation: Continuous Delivery for Cloud Services in Azure.
After configuring everything, when I queued my build - I got this error message - The specified module Azure was not loaded because no valid module file was found in any module directory
As soon as I looked this error I knew that this was coming from the PowerShell file named as - PublishCloudService.ps1 which you can get from the link mentioned above.
After quick search - I got a link which actually resolved the issue.
What was the issue?
The build was trying to launch the process on build server - PowerShell.exe but somehow system was not able to find the AzurePowerShell module path.
Solution:
Open your PowerShell Script file and find the command Import-Module Azure and add the following line just above it.
$env:PSModulePath=$env:PSModulePath+";"+"C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell"
After this modification , save the file and try to queue the build again.
I hope this helps someone.
Error Solved: The Specified Module Azure was not Loaded Because no Valid Module File was Found in any Module Directory
In this blog you will learn how to solve error "Specified Module Azure was not Loaded Because no Valid Module File was Found in any Module Directory ".


Join the conversation! Your thoughts help the community grow.