Problem scenario
Many Azure commands are failing. You installed the Azure module. But commands related to "Azure Storage" all return "not recognized as the name of a cmdlet, function, script file or operable program."
You see messages like this:
New-AzureStorageAccount : A parameter cannot be found that matches parameter name 'ResourceGroupName'.
At line:4 char:25
+ New-AzureStorageAccount -ResourceGroupName "contIntGroup" -AccountNam ...
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [New-AzureStorageAccount], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.WindowsAzure.Commands.ServiceManagement.StorageServices.NewAzureStorageAccountCommand
Get-AzureStorageAccountKey : The term 'Get-AzureStorageAccountKey' 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 line:5 char:16
+ $accountKey = (Get-AzureStorageAccountKey -ResourceGroupName contIntG ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-AzureStorageAccountKey:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
New-AzureStorageContext : Cannot validate argument on parameter 'StorageAccountKey'. The argument is null or empty. Provide an argument that is not null or empty, and
then try the command again.
At line:6 char:89
+ ... text -StorageAccountName $storageName -StorageAccountKey $accountKey
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [New-AzureStorageContext], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.WindowsAzure.Commands.Storage.Common.Cmdlet.NewAzureStorageContext
New-AzureStorageContainer : Could not get the storage context. Please pass in a storage context or set the current storage context.
At line:7 char:1
+ New-AzureStorageContainer -Name "templates" -Context $context -Permis ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureStorageContainer], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.NewAzureStorageContainerCommand
Set-AzureStorageBlobContent : Could not get the storage context. Please pass in a storage context or set the current storage context.
At line:9 char:1
+ Set-AzureStorageBlobContent -File "C:\Users\contint\Documents\WindowsPo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Set-AzureStorageBlobContent], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.WindowsAzure.Commands.Storage.Blob.SetAzureBlobContentCommand
Set-AzureStorageBlobContent : Could not get the storage context. Please pass in a storage context or set the current storage context.
At line:10 char:1
+ Set-AzureStorageBlobContent -File "C:\Users\contint\Documents\WindowsPo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Set-AzureStorageBlobContent], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.WindowsAzure.Commands.Storage.Blob.SetAzureBlobContentCommand
New-AzureResourceGroupDeployment : The term 'New-AzureResourceGroupDeployment' 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 line:14 char:1
+ New-AzureResourceGroupDeployment -Name "contintDeployment" -ResourceG ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (New-AzureResourceGroupDeployment:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
What should you do?
Solution
- Open PowerShell as administrator.
- Run this:
install-module AzureRM.storage
- If you have been running anti-malware applications on your desktop, and your laptop is reasonably secure, you can choose the "Y" option to the prompt about an untrusted repository and proceeding to install the modules from "PSGallery".
- You are done. Now the commands should work.