August 8th, 2024

Microsoft Dev Box Customization Now Supports Native Run-as-user

Jiayan Chen
Product Manager

Dev Box customization now supports native run as user in the customization yaml files. The native run-as-user capability is more powerful in terms of reliability, status tracking and error reporting. You can also see the execution progress on run-as-user customization tasks from Dev Portal. If you are using Dev Box customization, this feature will empower you to run tasks as user without having to implement run-as-user yourselves with scheduled tasks or following the samples. Go ahead and add your first userTasks and have us execute customization on your behalf!

Image Picture1

Run-as-user Tasks Comparison with System Tasks

All tasks under userTasks section will be executed as user after user’s first login to the Dev Box while all tasks under tasks will be executed as LocalSystem during the provisioning stage of the Dev Box. They will share same parameters based on the task definitions in your catalog.

When should I use Run-as-user Tasks?

You can use run-as-user Tasks for all software and packages you would like to install under user context. For example, Python and Visual Studio Code are the two common examples we have seen that users preferred to install under user context instead of for the whole system. For Winget tasks, we would recommend to put into userTasks for better results when it is not working under tasks.

State of Run-as-user Tasks

There are four different states shown in Dev Portal for all run-as-user tasks, accessible from the Customizations option from the ellipsis on your Dev Box in Dev Portal (devportal.microsoft.com).

Image Picture9

Not Started:

Image Picture2

The run-as-user task has not started and will be executed after you login to your Dev Box.

Running in Progress:

Image Picture3

The run-as-user task is being executed on the Dev Box.

Successful:

Image Picture4

It’s confirmed that the task run has been successful.

Failed:

Image Picture5

The run-as-user task has failed and you can use the download button to see the logs.

Migrating to Native Run-as-user Tasks

Previously when we public previewed the customization experience for Dev Box, we do have a parameter field in the Winget and Powershell tasks called runAsUser, you can move the same task to a separate section under userTasks to achieve the same goal with better results.

Old:

Image Picture6

New:

Image Picture7

Getting Started with Native Run-as-user Tasks

You can go to your customization yaml file to add your first userTask, then go to Dev Portal (devportal.microsoft.com) to upload the yaml file to start customization of your Dev Box.

Image Picture8

The native run-as-user customization tasks in Dev Box will help you to make your Dev Box ready to code and ready for you.

Please Share Your Feedback

After you try the native run-as-user feature of Dev Box customization, please use the links to Suggest a Feature for Dev Box to or report issues for Dev Box. We look forward to hearing from you!

Category
Dev Box

Author

Jiayan Chen
Product Manager

Jiayan is the Product Manager working on Dev Box customization and client experience.

0 comments

Discussion are closed.