Custom Script Extension vs Run Command for VM Configuration

Bombbe 1,441 Reputation points
2025-01-21T14:26:03.1833333+00:00

What are the differences and use cases for Custom Script Extension and Run Command when configuring virtual machines after deployment? Both options seem to achieve similar results, but it's challenging to find clear guidance or examples for choosing one over the other. Any tips or insights would be nice to have

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,284 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Srinud 3,585 Reputation points Microsoft Vendor
    2025-01-22T02:38:04.48+00:00

    Hi Bombbe,
    Thank you for reaching out to us on the Microsoft Q&A forum.
    The Custom Script Extension and Run Command are both options for configuring virtual machines after deployment, but they serve different purposes and are suited to different scenarios.

    The Custom Script Extension offers a more flexible and comprehensive solution for executing custom scripts (like PowerShell, Bash) directly on a virtual machine after its deployment. This extension is particularly designed for tasks involving the execution of scripts to configure software, install dependencies, or modify system settings.

    Run Command is a feature available through the Azure portal that enables the execution of scripts or commands directly on a virtual machine without requiring user login. This functionality allows for the execution of predefined or custom scripts on the VM without the need to deploy or manage additional extensions. it is particularly suitable for ad hoc or quick configuration tasks.

    Please find the document below for more information:

    If the information is helpful, please consider by clicking the "Accept answer and Upvote" on the post. If you have any further queries, please let us know in the comment.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.