Azure Run Command (RunPowerShellScript) feature on Windows VMs hangs indefinitely when executing commands that require **interactive user input (e.g., Yes/No confirmation prompts)**.
- Dominant language
- No language data
- Stars
- 21
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
Here’s a **ready-to-paste GitHub issue** formatted for Azure’s repositories (e.g., **Azure/azure-linux-extensions**, **Azure/WindowsVMAgent**, or internal extension repos). This follows GitHub issue conventions closely.
***
# 🐛 Bug: RunCommandWindows extension hangs indefinitely on interactive prompts
## 🔎 Description
The **Azure Run Command (RunPowerShellScript)** feature on Windows VMs hangs indefinitely when executing commands that require **interactive user input (e.g., Yes/No confirmation prompts)**.
The extension does not timeout, fail, or return an error. Instead, it enters a **blocked state**, preventing further Run Command usage and impacting VM manageability.
***
## 🔁 Steps to Reproduce
1. Open Azure Portal
2. Navigate to a **Windows Virtual Machine**
3. Go to:
```
Operations → Run command → RunPowerShellScript
```
4. Execute a command that triggers a confirmation prompt, for example:
```powershell
net user tmpadminuser 123456789012345678 /add
```
*(Any command prompting for user input will reproduce the issue)*
***
## ❗ Observed Behavior
* Run Command execution starts but **never completes**
* No output is returned in the portal
* The command remains in a **running state indefinitely**
* Subsequent Run Command executions:
* Do not start or also hang
* VM extension management via Portal becomes unreliable
***
## ✅ Expected Behavior
One of the following should occur:
* The command should **fail immediately** with a clear error:
> "Interactive commands are not supported in Run Command"
* The extension should **timeout gracefully**
* The system should **validate input beforehand and reject unsupported commands**
***
## 🧠 Analysis
Run Command executes scripts in a **non-interactive context**:
* No stdin is available
* Prompts requiring user confirmation block execution
* The extension does not detect or handle this condition
This results in:
* A **hung PowerShell process**
* Extension stuck in a **blocked execution state**
* No automatic recovery or timeout
***
## 💥 Impact
* VM becomes partially **unmanageable via Azure Portal**
* Affects:
* Run Command
* Extension lifecycle operations
* Requires **manual intervention inside the VM**
* Breaks automation scenarios relying on Run Command
***
## 🛠️ Workaround
To unblock the VM:
1. Log in to the VM via RDP
2. Navigate to:
```
C:\Packages\Plugins\Microsoft.CPlat.Core.RunCommandWindows\\Downloads
```
Example:
```
C:\Packages\Plugins\Microsoft.CPlat.Core.RunCommandWindows\1.1.22\Downloads
```
3. Delete all files matching:
```
script*.ps1
```
4. Retry Run Command
***
## 💡 Suggested Fixes
* Detect interactive prompts and **fail fast**
* Implement **execution timeout enforcement**
* Validate commands to ensure **non-interactive compatibility**
* Improve documentation to clearly state:
> Run Command does not support interactive input
***
## 📋 Environment
* OS: Windows Server (observed on multiple versions)
* Extension:
```
Microsoft.CPlat.Core.RunCommandWindows v1.1.22
```
* Reproducibility: ✅ Always
* Scope: ✅ Multiple VMs
***
## 📌 Summary
Interactive commands cause the **RunCommandWindows extension to hang indefinitely**, requiring manual cleanup and impacting VM operability. Proper validation or timeout handling is missing.
***
If you want, I can also suggest the **best repo to file this against** (VM Agent vs RunCommand extension) to increase the chances of a fast response from Microsoft.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the hang with the RunPowerShellScript entry point and the example net user command, then inspect the RunCommandWindows extension behavior around C:\Packages\Plugins\Microsoft.CPlat.Core.RunCommandWindows\1.1.22\Downloads and script*.ps1. Confirm how the non-interactive PowerShell process is left running and whether extension operations remain blocked. Done means interactive input produces a clear failure or graceful timeout instead of an indefinite running state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, powershell
- Domain
- cloud, devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100