Replies: 5 comments 4 replies
-
| @aleqsss we run the scripts on production VMs in a very similar way, so it's a good chance that everything will work as expected | 
Beta Was this translation helpful? Give feedback.
-
| @aleqsss hope to not bother you too much since I've got the very same question. I deployed the VMSS with a custom script extension that executes the post-gen scripts. The post-gen scripts are runnned as soon as a VMSS is deployed so before it is added to the ADO VMSS Agentpool hence when they run, they modify every time $HOME occurs in the /etc/environment file with the VM initial username and not the AzDevOps username. Is it running as expected? As with this method I have plenty of problems with permissions denied, however if I run it after the ADO Agent $HOME get substituted with AzDevOps and I don't have so many permissions problem. How do you run the post-gen script? Before or after installing the ADO VMSS Agent? Thanks | 
Beta Was this translation helpful? Give feedback.
-
| Hello @lrebosio, If I remember correctly, we had similar problems with that approach. We ended up not running them at all and have not since (~2 years on many agent pools). We've not yet noticed any issues connected to not running them (at least what we know) and hopefully we never will. 🙂 I never investigated it more than this, since I got caught up in many other things and this was not affecting us. Unfortunately I can't give you a better answer than that, or provide you with a direct solution. | 
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
| 🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as  2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the  Thank you for helping bring this Discussion to a resolution! 💬 | 
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
As stated under the Post-generation-scripts step of the create-image-and-azure-resources documenation, one should run the following command (on machines which are using the generated virtual machine image):
sudo su -c "find /opt/post-generation -mindepth 1 -maxdepth 1 -type f -name '*.sh' -exec bash {} \;"Because of the following stated reason:
The user, created during the image generation, does not exist in the result VHD hence some configuration files related to the user's home directory need to be changed as well as the file permissions for some directories.
The documentation also states:
Note: The default user for Linux should have sudo privileges.
And:
The scripts are copied to the VHD during the image generation process to the following paths:
What if one would like to run these scripts from a Virtual Machine extension inside of Azure? So that when a Virtual Machine boots up, the scripts will be run. Will this be ok? Will the scripts be run and configure the resources as intended?
I'm asking this because we're using Virtual Machine Scale Set Agents, so that when a machine boots up I want the post-generation scripts to be run successfully, and then the pipelines/agent in this setup will be run with a user called AzDevOps (with a home directory of /home/AzDevOps).
So, if the post-generation scripts are run by an Azure Virtual Machine extension, will the Azure Pipelines agent (and its associated user: AzDevOps) have the correct settings from the scripts?
If not, how could this be achieved without any manual steps?
Beta Was this translation helpful? Give feedback.
All reactions