azure-docs
azure-docs copied to clipboard
pass custom data to the VM when creating via the site wizard (not cli)
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.
- ID: 282b39fe-e8fe-f698-36c2-321f088f6554
- Version Independent ID: 2a7c130c-291b-40ff-cae5-43255bcb3bc3
- Content: Custom data and Azure virtual machines - Azure Virtual Machines
- Content Source: articles/virtual-machines/custom-data.md
- Service: virtual-machines
- GitHub Login: @mimckitt
- Microsoft Alias: mimckitt
@omuleanu Thanks for your feedback! We will investigate and update as appropriate.
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
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 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 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.
@mimckitt Could you please review add comments on this, update as appropriate.
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
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