Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Task 02 - Run script to add server to Azure Arc

Introduction

Terra Firm Laboratories wants to migrate several on-premises workloads to Microsof Azure. For some workloads there are no plans to migrate it to Azure. In this task, you will run the script on the on-prem VM that hosts the web application to enable Azure Arc.

Description

In this task, you will run the script in the on-prem VM.

The key tasks are as follows:

  1. Run the script in the on-prem VM.
  2. After the script, a message stating “Connected machine to Azure” will be shown.

Success Criteria

  • Successfully run the script.
  • A message stating “Connected machine to Azure” will be shown after running the script.

Solution

Expand this section to view the solution
  1. In the Azure Portal, navigate to the Resource Group that you created for this lab, then select the On-premises APP VM named similar to terrafirm-onprem-app-vm.

    The Resource group with on-premises APP VM highlighted.

  2. On the left, select Bastion under Connect.

  3. Enter the Username and Password, then select Connect.

    Note: When the VM was created the credentials were set up as:

    • Authentication Type: VM Password
    • Username: demouser
    • Password: <the password you chose when provisioning the VM>
  4. Once connected to the Linux Host VM, run the following cmd:

         sudo systemctl is-active walinuxagent && systemctl stop walinuxagent
         sudo systemctl is-active walinuxagent && systemctl disable walinuxagent
    

    Note: The output should show that the walinuxagent service is inactive.

  5. Run the following cmd:

         sudo firewall-cmd --permanent --direct --add-rule ipv4 filter OUTPUT 1 -p tcp -d 169.254.169.254 -j REJECT
         sudo firewall-cmd --reload
    

    Note: The output should show that the firewall rules have been updated.

  6. Within the Virtual Machine Bastion Connection, paste in the contents of the Azure Arc OnboardingScript.sh script previously downloaded.

  7. Run the full script. This will install the Azure Arc agent and Arc-enable the VM. When the script asks to open a browser window to authenticate, follow the instructions and enter your credentials to authenticate with Azure.

    **Note: Use the bastion clipboard by coping any commands and then opening the clipboard to retrieve the text you are copying

  8. When the script finishes executing successfully, a message stating “Connected machine to Azure” will be shown, along with the Azure Portal resource URL for the Azure Arc-enabled Server