What is the custom data in Microsoft Azure?

Source: Internet
Author: User
Keywords Azure azure custom data

What is the custom data?

Customers often ask how they can insert scripts or other metadata when configuring Http://www.aliyun.com/zixun/aggregation/13460.html ">microsoft Azure virtual machines." In other clouds, this concept is often referred to as user data. Microsoft Azure also has a similar feature that we call custom data.

Custom data is sent to the VM along with other configuration information, such as a new host name, user name, password, certificate, and key. This type of data is Base64 encoded and passed to the Azure API. On Windows, custom data is eventually saved as a binary file in%systemdrive%\azuredata\customdata.bin. On Linux, custom data is copied to the Ovf-env.xml file in the/var/lib/waagent directory when the virtual machine is created. For convenience, newer versions of Microsoft Azure Linux agents also replicate Base64 encoded data to/var/lib/waagent/customdata.

What is Cloud-init?

Currently, only the Ubuntu mirrors in the Microsoft Azure Library are preinstalled with Cloud-init and set to handle custom data sent during virtual machine creation. This means that for Ubuntu, you can use the Cloud-init profile to create a VM with custom data, or just send a script that Cloud-init will execute at creation time. For more information, see the Cloud-init documentation.

If you cannot use Cloud-init on a mirror, you can still use the custom data that is provided when you preinstall scripts or other tools on your system that can read data. In this case, you may be able to install the custom data through%systemdrive%\azuredata\customdata.bin (Windows) or/var/lib/waagent/ovf-env.xml (Linux) A script that is read by a file, runs the script at startup, and decodes it to work with custom data. After you install the script, you can cancel the configuration of Windows or Linux mirrors and capture this mirror for reuse.

Working principle

Currently, the easiest way to insert custom data into an IaaS VM is to use the Windows Azure command-line tool. Currently, the Microsoft Azure Powershell cmdlet does not yet support this feature, but will soon be available in the upcoming release.

A new parameter called--custom-data has occurred since the CLI tool 0.7.5 Edition. This parameter regards the file name as an argument, and the CLI tool encodes the contents of the file using Base64 and sends it along with the configuration information. The only limitation here is that the file must be less than 64KB or the Azure API will not accept the request.

Here's a simple example of how to prepare and deliver custom data to an Ubuntu Linux VM:

In this example, Custom-data.txt can be either a cloud-init configuration file or just a shell script (as long as the #! Beginning, Cloud-init will execute). Try it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.