{"id":220,"date":"2024-08-08T08:00:45","date_gmt":"2024-08-08T15:00:45","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/?p=220"},"modified":"2024-11-19T10:43:32","modified_gmt":"2024-11-19T18:43:32","slug":"microsoft-dev-box-customization-now-supports-native-run-as-user","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/microsoft-dev-box-customization-now-supports-native-run-as-user\/","title":{"rendered":"Microsoft Dev Box Customization Now Supports Native Run-as-user"},"content":{"rendered":"<p>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 <a href=\"https:\/\/github.com\/microsoft\/devcenter-catalog\/tree\/main\/Tasks\">samples<\/a>. Go ahead and add your first userTasks and have us execute customization on your behalf!<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture1.png\"><img decoding=\"async\" class=\"wp-image-222 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture1.png\" alt=\"Image Picture1\" width=\"469\" height=\"173\" srcset=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture1.png 936w, https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture1-300x111.png 300w, https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture1-768x284.png 768w\" sizes=\"(max-width: 469px) 100vw, 469px\" \/><\/a><\/p>\n<h3>Run-as-user Tasks Comparison with System Tasks<\/h3>\n<p>All tasks under <span style=\"font-family: 'courier new', courier, monospace;\">userTasks<\/span> section will be executed as user after user\u2019s first login to the Dev Box while all tasks under <span style=\"font-family: 'courier new', courier, monospace;\">tasks<\/span> 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.<\/p>\n<h3>When should I use Run-as-user Tasks?<\/h3>\n<p>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 <span style=\"font-family: 'courier new', courier, monospace;\">userTasks<\/span> for better results when it is not working under <span style=\"font-family: 'courier new', courier, monospace;\">tasks<\/span>.<\/p>\n<h3>State of Run-as-user Tasks<\/h3>\n<p>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).<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture9.png\"><img decoding=\"async\" class=\"wp-image-230 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture9.png\" alt=\"Image Picture9\" width=\"473\" height=\"395\" srcset=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture9.png 1636w, https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture9-300x250.png 300w, https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture9-1024x854.png 1024w, https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture9-768x640.png 768w, https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture9-1536x1281.png 1536w\" sizes=\"(max-width: 473px) 100vw, 473px\" \/><\/a><\/p>\n<p><strong>Not Started:<\/strong><\/p>\n<h2><a href=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture2.png\"><img decoding=\"async\" class=\"wp-image-223 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture2.png\" alt=\"Image Picture2\" width=\"479\" height=\"259\" srcset=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture2.png 468w, https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture2-300x162.png 300w\" sizes=\"(max-width: 479px) 100vw, 479px\" \/><\/a><\/h2>\n<p>The run-as-user task has not started and will be executed after you login to your Dev Box.<\/p>\n<p><strong>Running in Progress:<\/strong><\/p>\n<h2><a href=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture3.png\"><img decoding=\"async\" class=\"wp-image-224 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture3.png\" alt=\"Image Picture3\" width=\"481\" height=\"262\" srcset=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture3.png 468w, https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture3-300x163.png 300w\" sizes=\"(max-width: 481px) 100vw, 481px\" \/><\/a><\/h2>\n<p>The run-as-user task is being executed on the Dev Box.<\/p>\n<p><strong>Successful:<\/strong><\/p>\n<h2><a href=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture4.png\"><img decoding=\"async\" class=\"wp-image-225 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture4.png\" alt=\"Image Picture4\" width=\"480\" height=\"273\" srcset=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture4.png 816w, https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture4-300x171.png 300w, https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture4-768x437.png 768w\" sizes=\"(max-width: 480px) 100vw, 480px\" \/><\/a><\/h2>\n<p>It\u2019s confirmed that the task run has been successful.<\/p>\n<p><strong>Failed:<\/strong><\/p>\n<h2><a href=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture5.png\"><img decoding=\"async\" class=\"wp-image-226 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture5.png\" alt=\"Image Picture5\" width=\"479\" height=\"246\" srcset=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture5.png 936w, https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture5-300x154.png 300w, https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture5-768x394.png 768w\" sizes=\"(max-width: 479px) 100vw, 479px\" \/><\/a><\/h2>\n<p>The run-as-user task has failed and you can use the download button to see the logs.<\/p>\n<h3>Migrating to Native Run-as-user Tasks<\/h3>\n<p>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.<\/p>\n<p><strong>Old:<\/strong><\/p>\n<h2><a href=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture6.png\"><img decoding=\"async\" class=\"wp-image-227 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture6.png\" alt=\"Image Picture6\" width=\"815\" height=\"238\" srcset=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture6.png 904w, https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture6-300x88.png 300w, https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture6-768x224.png 768w\" sizes=\"(max-width: 815px) 100vw, 815px\" \/><\/a><\/h2>\n<p><strong>New:<\/strong><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture7.png\"><img decoding=\"async\" class=\"wp-image-228 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture7.png\" alt=\"Image Picture7\" width=\"817\" height=\"198\" srcset=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture7.png 932w, https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture7-300x73.png 300w, https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture7-768x186.png 768w\" sizes=\"(max-width: 817px) 100vw, 817px\" \/><\/a><\/p>\n<h3>Getting Started with Native Run-as-user Tasks<\/h3>\n<p>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.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture8.png\"><img decoding=\"async\" class=\"size-full wp-image-229 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture8.png\" alt=\"Image Picture8\" width=\"540\" height=\"680\" srcset=\"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture8.png 540w, https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-content\/uploads\/sites\/81\/2024\/08\/Picture8-238x300.png 238w\" sizes=\"(max-width: 540px) 100vw, 540px\" \/><\/a><\/p>\n<p>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.<\/p>\n<h3>Please Share Your Feedback<\/h3>\n<p>After you try the native run-as-user feature of Dev Box customization, please use the links to <a href=\"https:\/\/aka.ms\/vs-suggest\">Suggest a Feature for Dev Box<\/a> to or <a href=\"https:\/\/developercommunity.visualstudio.com\/devbox\/report\">report issues for Dev Box<\/a>.\u00a0We look forward to hearing from you!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":116981,"featured_media":228,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[2,9],"class_list":["post-220","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dev-box","tag-dev-box","tag-developer-productivity"],"acf":[],"blog_post_summary":"<p>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 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-json\/wp\/v2\/posts\/220","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-json\/wp\/v2\/users\/116981"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-json\/wp\/v2\/comments?post=220"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-json\/wp\/v2\/posts\/220\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-json\/wp\/v2\/media\/228"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-json\/wp\/v2\/media?parent=220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-json\/wp\/v2\/categories?post=220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/develop-from-the-cloud\/wp-json\/wp\/v2\/tags?post=220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}