Azure / Azure/azure-powershell
Start-AzureRmVM cmdlet stuck in running state for hours
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 51
Description
### Description
I'm trying to turn on a VM via PowerShell but I'm running into an odd issue. I'm using Start-AzureRmVm to start the machine. The command will run with no errors however even after the VM starts the cmdlet never finishes. It's almost like its waiting for a running status that never gets passed. I have to either stop the script using crtl+c or close the shell. While the command is running I can log into the Azure portal and verify that the machine is up and in a running state. I ran into this once before and deleted the VM and started over with a new VM. This worked for awhile but now the same issue is back. I can reproduce this issue on several machines, inside of a runbook, using a code editor like VS Code / ISE and even with the native shell. Has anyone seen this before? The VM is a build from the MS marketplace, I'm using one of the predefined Citrix Netscaler templates.
OSDiskName = netscalerosdisk
Publisher = citrix
Product = netscalervpx-120 (netscaler10standard)
I opened a case with Microsoft support but they said it's an issue with the cmdlet and I need to open a bug here.
### Script/Steps for Reproduction
I can reproduce the issue with the code below. The line Write-Output never runs and the text is never displayed. The shell is "stuck" waiting for the Start-AzureRmVM cmdlet to finish.
```powershell
[string] $sourceVM = 'vm9'
[string] $sourceResourceGroup = 'RG-Test-Production'
Write-Output "starting source vm $sourceVM"
Start-AzureRmVM -ResourceGroupName $sourceResourceGroup -Name $sourceVM
Write-Output "never writes this line..."
```
### Module Version
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 5.7.0 AzureRM
```powershell
Get-Module -Name AzureRM -ListAvailable
```
### Environment Data
Name Value
---- -----
PSVersion 5.1.16299.431
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16299.431
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```powershell
$PSVersionTable
```
### Debug Output
```
```
Contributor guide
Assessment
This issue has not been assessed yet.