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.