Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
When trying to run Windows Azure Powershell commands in Windows Azure VM (Web Role or Worker Role) instance you will hit the following exception:
PS D:\Users\avkash> Add-PSSnapin Microsoft.WindowsAzure.ServiceRuntime
Add-PSSnapin : Cannot add Windows PowerShell snap-in Microsoft.WindowsAzure.ServiceRuntime because it is already added.
Verify the name of the snap-in and try again.
At line:1 char:13
+ Add-PSSnapin <<<< Microsoft.WindowsAzure.ServiceRuntime
+ CategoryInfo : InvalidArgument: (Microsoft.WindowsAzure.ServiceRuntime:String) [Add-PSSnapin], PSArgume ntException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
The reason for this exception is conflict between Powershell version required by Windows Azure runtime components. AS you can see below the PS version is incorrectly set in the Azure role instance VM:
To solve this problem you would need to change the PowerShell version in Windows Azure Instance according to your Windows Azure application SDK. For example if your application is based on Windows Azure SDK 1.8 then you will need to change Powershell setting to use SDK 1.8 as below:
Version : 1.8.0.0
That's all you need to get powershell working,
Please sign in to use this experience.
Sign in