Azure Classroomnotes 22/Feb/2023

Azure VM Custom Data and User Data

  • Custom Data and User Data are the scripts that can be executed while VM is being created (Provisioned)
  • User Data is latest version of Custom Data where Azure Instance Metadata Service is accessible
  • Steps
#!/bin/bash
apt update
apt install apache2 stress -y
apt install php libapache2-mod-php php-mysql -y
echo '<?php phpinfo(); ?>' > /var/www/html/info.php
systemctl restart apache2
  • Lets create an Azure VM with the above as user data
    Preview
    Preview

Preparation

  • Create a ubuntu linux vm
  • Become a root user sudo -i
  • Execute the following commands
apt update
apt install apache2 stress -y
apt install php libapache2-mod-php php-mysql -y
echo '<?php phpinfo(); ?>' > /var/www/html/info.php
systemctl restart apache2
  • From the VM Created above, we can create resuable images.
  • Azure Supports creating reusable images in two ways
    • Azure managed Image
    • Azure Compute Gallery

Generalized and Specialized VM Images

  • Azure Generalized VM allows users to set credentials while provisioning, whereas specialized VM images don’t allow to set credentials
  • Azure Managed Image:
    • This creates Generalized VM Images
  • Azure Compute Gallery
    • This creates both Generalized as well as specialized VM Images
  • Note: If we need to create Generalized VM Image, the user specific information has to be removed, so the source vm becomes unusable.

Create a Managed Image

  • Click Capture
    Preview
    Preview
    Preview
    Preview
    Preview
  • Now lets try to create a vm with the captured image
    Preview
    Preview
    Preview
  • Note:

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Network Widget by Acurax Small Business Website Designers

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube