Microsoft Azure

Load balancing and high availability using Azure Load Balancer between two virtual machines (Part 2: Creating the second virtual machine using JSON templates)

In this second part we will see how to create a virtual machine and place it within the same availability set using the template of the first virtual machine and making changes in Visual Studio 2017

  1. Unzip the downloaded file
  2. Open Visual Studio and select File &gt New Project, search within Cloud > Azure Resource Group and name it as the resource group that we created, for this example we named it rg-vvillar and then click OK
  3. A window will appear in which we will select Blank Template an then click on OK
  4. In the project copy the contents of the unzipped file template.json in azuredeploy.json and the contents of the file parameters.json in azuredeploy.parameters.json
  5. In the file azuredeploy.json modify the line 33 that says “value”: “pip-vvillar” and we add a 2 at the end to be “value”: “pip-vvillar2” so we avoid repeating the same name in the public IP
  6. In the same way in the line 42 we change the value of the name of the virtual machine “value”: “vm-vvillar” to “value”: “vm-vvillar2”
  7. Delete lines 55, 56 and 57 so that when you deploy the template using PowerShell, you will be asked to create a Password. Save the changes.
  8. Open the PowerShell ISE program and write the lines of code
    Login-AzureRmAccount
    Select-AzureRmSubscription -SubscriptionId <The ID of the subscription >
    Note: If you do not know where the subscription ID is located, you can access the Subscriptions resource in the Azure portal and there view our subscription ID. A login window will appear, enter the Azure username and password
  9. In Visual Studio, right click on Deploy-AzureResourceGroup.ps1 and select Open with PowerShell ISE
  10. Execute the Script by pressing F5 or clicking on the button with the green arrow at the top of the window.
  11. Indicate as values:
    ResourceGroupLocation: eastus
    adminPassword: <A 12-digit password that has at least one uppercase, numbers or special characters >
  12. Wait a few minutes and you should see a message with the resources created

With this we would already have the two virtual machines within the same Availabity Set and we can create our load balancing infrastructure, but first we will enable the network security Group to enter the virtual machines

Click here to go to the third part

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments