I'm trying to run a PowerShell script that functions on a colleague's computer, but is failing on mine on this line:
Set-Variable -Name StorageContext -Value (New-AzureStorageContext -ConnectionString $storageConnectionString)
My error is:
New-AzureStorageContext : The term 'New-AzureStorageContext' 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 C:\Users\dlogg\Documents\Repos\sd2\PowerShell Scripts\Eco\AddEco.ps1:22 char:43 + Set-Variable -Name StorageContext -Value (New-AzureStorageContext -ConnectionStr...
I have confirmed I have PowerShell v.3, and I have installed Azure PowerShell with Microsoft Azure SDK and Microsoft Azure PowerShell (Standalone) from Web PI. What do I need to install to use this?
http://msdn.microsoft.com/en-us/library/azure/dn495246.aspx
UPDATE: Per the request below, I have included the output of Get-Module
:
ModuleType Name ExportedCommands
---------- ---- ----------------
Script Common {Fetch, Get-BlobContainer, Get-ConfigurationFileName, Get-DeploymentTenantListFileName...}
Script ISE {Get-IseSnippet, Import-IseSnippet, New-IseSnippet}
Manifest Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}
Manifest Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
i have same problem with you. my problem is using the wrong command :"AzureStorageContext".it shoud "AzStorageContext"
You haven't loaded the Azure PowerShell module (hence it is missing from the list you have). When you install the Cmdlets you will also get a new shortcut "Microsoft Azure Powershell" which will automatically load the module for you (and make the Cmdlets available).
If you don't want to do it that way you can import the module into an existing PowerShell session using this command (note that the path to the Azure module may differ depending on the version you have installed).
Import-Module "C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Azure.psd1"
Which version of Azure PowerShell module are you using? Have you loaded the Azure module, or just running PowerShell (or via the Azure PowerShell shortcut).
Here is output from Azure PowerShell module 0.8.8.1
PS C:\> Get-Module
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 0.8.8.1 Azure {Add-AzureAccount, Add-AzureCacheWorkerRole, Add-AzureCert...
Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Con...
Manifest 3.0.0.0 Microsoft.PowerShell.Security {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl...
Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
PS C:\> New-AzureStorageContext
cmdlet New-AzureStorageContext at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
StorageAccountName:
The best way to use Azure PowerShell cmdlets is to start the Azure PowerShell directly from the generated shortcut by the installer. Or use the Import-Module
command to import Azure PowerShell module.
For detailed instructions, read the How to: Install and configure Azure Power Shell module. And also check this ServerFault question and answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With