GuideInformationBusiness ContinuityIT

Read the managed Run Command script result separately from provisioning status

Can a managed Run Command resource provision successfully while the Windows script itself fails?

A controlled technology lifecycle progressing from assessment to approved production.
DSE visual intelligenceManaged IT operationsGuide · 2 min read
Executive summary

What you need to know

Can a managed Run Command resource provision successfully while the Windows script itself fails?

Potentially affected

Windows Azure VMs using managed Run Command resources through CLI, PowerShell, or API.

DSE recommendation

Require the script's execution state and exit code in completion evidence, with deployment-failure propagation chosen explicitly.

Source facts

Managed Run Command distinguishes extension provisioning from the script’s execution result. The expanded instance view exposes execution state, exit code, output, and error; a nonzero exit code indicates failure. With treatFailureAsDeploymentFailure set false, provisioning status does not report script failure. API version 2023-03-01 introduced the option to set that property true and fail deployment when the script fails. Instance-view output and error retain only their final 4 KB. Microsoft Learn.

Applicability

Use this acceptance check for managed Run Command on Windows VMs, not merely the original action-oriented command interface. Identify the exact named command resource and whether the caller expects script failure to fail the surrounding deployment. Keep transport or provisioning success separate from the application’s intended result.

DSE recommendation

Require the script’s execution state and exit code in completion evidence, with deployment-failure propagation chosen explicitly. Have the script owner document meaningful failure exits and any output that must be retained beyond the instance-view tail. Avoid declaring a repair complete from a successful resource deployment alone.

Verification

Run a benign success case and a deliberately failing case on a disposable VM. For each, compare provisioning state, expanded execution state, exit code, and the deployment result under the selected setting. Inspect the script’s actual target condition separately. Retain the exact command identity and terminal result so later cleanup or another execution cannot be mistaken for the run being reviewed.

Official references

Microsoft Learn: Managed Run Command for Windows. Source reviewed September 9, 2026.

Primary reference

Review the official source

Run scripts in a Windows VM in Azure using managed Run Commands - Azure Virtual Machines | Microsoft Learn · Verified September 9, 2026

Open official reference ↗
Plan the next step

Need help applying this guidance safely?

DSE can help confirm applicability, protect service continuity, and validate the result across physical security and IT systems.

Talk with DSE