"New-AzureStorageContext" is not recognized
I'm trying to run a PowerShell script that is running on a colleague's computer, but I can't get it on this line:
Set-Variable -Name StorageContext -Value (New-AzureStorageContext -ConnectionString $storageConnectionString)
My mistake:
New-AzureStorageContext: The term "New-AzureStorageContext" is not recognized as the name of a cmdlet, function, script file, or runnable program. Check the spelling of the name or, if the path was specified, check the correct path and try again. In C: \ Users \ dlogg \ Documents \ Repos \ sd2 \ PowerShell Scripts \ Eco \ AddEco.ps1: 22 char: 43 + Set-Variable -Name StorageContext -Value (New-AzureStorageContext -ConnectionStr ...
I confirmed that I have PowerShell v.3 and I installed Azure PowerShell with Microsoft Azure SDK and Microsoft Azure PowerShell (standalone) from Web PI. What do I need to install in order to use this?
http://msdn.microsoft.com/en-us/library/azure/dn495246.aspx
UPDATE: As per the request below, I've included the output 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...}
source to share
You have not downloaded the Azure PowerShell Module (hence it is not listed). When you install the Cmdlets, you will also receive a new "Microsoft Azure Powershell" shortcut that will automatically download the module for you (and make the Cmdlets available).
If you don't want to do this, 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 installed).
Import-Module "C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Azure.psd1"
source to share
Which version of the Azure PowerShell Module are you using? Have you downloaded the Azure Module or just started PowerShell (or using the Azure PowerShell shortcut).
This is where Azure PowerShell Module 0.8.8.1 is output
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 launch Azure PowerShell directly from the generated shortcut by the installer. Or use the command Import-Module
to import the Azure PowerShell module.
For detailed instructions, see How to install and configure the Azure Power Shell module . And also check this question and the answer on ServerFault .
source to share
You need to install the Azure Power Shell like the Microsoft site https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-1.1.0.
Works great
source to share
Install Microsoft SDK for PowerShell from url - https://azure.microsoft.com/en-in/downloads/
Restart your Windows computer and try the script. It will work as expected
source to share