1

I am attempting to use the Azure Cloud Shell (browser based) to manage a classic VM. When I run this command:

Stop-AzureVM -ResourceGroupName <resourceGroup> -Name <vmName>

I get this error:

Stop-AzureVM : The term 'Stop-AzureVM' 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:1 char:1
+ Stop-AzureVM -ResourceGroupName <resourceGroup>-Name <vmName>
+ ~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (Stop-AzureVM:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Am I doing anything wrong, or is this just not supported in Cloud Shell?

Captain Whippet
  • 2,143
  • 4
  • 25
  • 34

2 Answers2

3

By default, AzureRM Module is used. For PowerShell on Azure Cloudshell, you need to install classic ASM module. Just simply run

Install-Module Azure

Try to use Get-Module -Name Azure* to see if the ASM module is installed.

enter image description here

Now you can play with your Azure classic resource.

If you have more than one subscription in ASM model, you need to set the subscription first, using

Select-AzureSubscription -Default -SubscriptionName "your_subscription_name"
EagleDev
  • 1,754
  • 2
  • 11
  • 31
  • Thanks, that _nearly_ works. The `Select-AzureSubscription` command doesn't recognise my subscription name. I think I might need to do `Add-AzureAccount` but that gives me `Unable to load DLL 'IEFRAME.dll'`. – Captain Whippet Mar 19 '18 at 16:13
  • Try with `-SubscriptionId` or `-Name` As ASM module is not being supported well at the moment, the parameter might be changed. I have no issue with `Select-AzureSubscription`. But because I don't have classic subscription so couldn't so you the screenshot. – EagleDev Mar 19 '18 at 16:15
1

but that gives me Unable to load DLL 'IEFRAME.dll'

Azure cloud shell does not support use another account to login it.

Cloud Shell also securely authenticates automatically for instant access to your resources through the Azure CLI 2.0 or Azure PowerShell cmdlets.

As a workaround, maybe you can use cloud shell bash to stop that VM(classic).

Azure CLI 1.0 support ASM and ARM, just change mode to ASM, you can use cloud shell to manage your classic VM, like this:

azure config mode asm
azure vm list
azure vm --help  //get more information about CLI 1.0

enter image description here

Hope this helps.

Jason Ye
  • 13,710
  • 2
  • 16
  • 25