azure-docs icon indicating copy to clipboard operation
azure-docs copied to clipboard

pass custom data to the VM when creating via the site wizard (not cli)

Open omuleanu opened this issue 10 months ago • 6 comments

When creating a VM using the azure website (not cli), do we have to base64 encode this text (bash script in my case) in advance ?


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

omuleanu avatar Apr 24 '24 18:04 omuleanu

@omuleanu Thanks for your feedback! We will investigate and update as appropriate.

TPavanBalaji avatar Apr 25 '24 04:04 TPavanBalaji

Hello @omuleanu Please go through this below link for your reference. https://learn.microsoft.com/en-us/azure/virtual-machines/custom-data#:~:text=You%20might%20need,processes%20those%20parameters

image

When setting up a Microsoft Azure virtual machine (VM), you might want to add a script or metadata. This is similar to user data in other clouds and called custom data in Azure. In Advanced --> custom data box. We need to provide the required data then create a virtual machine.

Naveenommi-MSFT avatar Apr 25 '24 07:04 Naveenommi-MSFT

@Naveenommi-MSFT I tried it, I tried adding a bash script to install docker (os debian), and it didn't work, after I tried encoding it to base64 using certutil and pasted it there, it also didn't work,

the docs only shows an example for the cli, actually I'm not sure this script is supposed to be executed, the page only says that this script will be saved in a "known location" (whatever that means), I don't know that location.

omuleanu avatar Apr 25 '24 07:04 omuleanu

@omuleanu Thank you for bringing this to our attention. I've delegated this to content author @mimckitt, who will review it and offer their insightful opinions.

Naveenommi-MSFT avatar Apr 29 '24 09:04 Naveenommi-MSFT

@mimckitt Could you please review add comments on this, update as appropriate.

Naveenommi-MSFT avatar Apr 29 '24 09:04 Naveenommi-MSFT

I tried it a few times now, and there's no need for encoding it, my problem now is that the exact same bash script that I run successfully manually (after connecting via putty for example), doesn't work in the custom data, I'm getting errors like:

E: Could not get lock /var/lib/apt/lists/lock. It is held by process 700 (apt-get)
E: Unable to lock directory /var/lib/apt/lists/

for a simple sudo apt update call, ( looking at the logs in var/logs/cloud-init-output.log ) do we need some sort of sleep or waitForInitialization command at the start ? I'm using VM B1s with Debian Bullseye 11

omuleanu avatar Apr 29 '24 10:04 omuleanu

Thanks for your contribution to our documentation

We are moving to a new user feedback system. As part of that effort, we are creating a content request in our backlog to address this gap and are closing this GitHub issue. The updated content will be published shortly.   Please continue to provide feedback about the documentation. We appreciate your contributions to our community.

#please-close

akashdubey-ms avatar Jul 28 '24 21:07 akashdubey-ms