How to add Azure Virtual machine to an existing availability set?

0 votes

Hey guys

I want to create two virtual machines in Azure which should not be connected to each other. I created first virtual machine and also created an availability set as part of its creation process.

Now when I create the second virtual machine then I don't get the availability set created as part of first virtual machine in the drop down list of availability sets.

However if I try to connect the second virtual machine as part of first one then I am able to see the availability set created as part of first virtual machine.

Is it mandatory for virtual machines to be connected to each other so that I can add them to the same availability set? Is this a limitation only from azure portal and there is a workaround using powershell?

UPDATE:

If we connect two virtual machines then we can get the benefit of availability set. However, at the same time both virtual machine becomes part of same cloud service and hence are load balanced by azure which does not support sticky session.

My scenerio is that I have identical front-ends which needs to support sticky session. Therefore I don't want to connect them to each other. However, I want to get the benefits of availability sets as mentioned in the article on Availability sets.

So can I set availability set for two identical virtual machines not connected to each other?

TIA

Aug 9, 2018 in Azure by cloudie_crank
• 1,610 points
4,360 views

1 answer to this question.

0 votes

You cannot associate an Availability Set to an existing Virtual Machine, as it can be done only while creating a new VM.

There is a workaround for this, where you can recreate a new VM from existing one and to make it really easy, there is a powershell script to do this for you here - https://gallery.technet.microsoft.com/Set-Azure-Resource-Manager-f7509ec4

Run the script and provide the requested parameters -

Set-ArmVmAvailabilitySet.ps1 –VmName 'MyNewVmName' –ResourceGroup 'MyResource Group' –AvailabilitySetName 'AsName'
Key in your subscription details when prompted for it.
answered Aug 9, 2018 by null_void
• 3,220 points

Related Questions In Azure

0 votes
1 answer

How to add an App Settings to existing Azure Web Application using Azure Power Shell?

The example is for slot-specific settings, if ...READ MORE

answered Jun 13, 2018 in Azure by club_seesharp
• 3,450 points
501 views
0 votes
1 answer

How can I replicate an Azure Virtual Machine?

To create a managed image of a ...READ MORE

answered May 23, 2018 in Azure by club_seesharp
• 3,450 points
130 views
+1 vote
1 answer

In Azure ,can we add the existing VM into Availability Set or Availability Zone

Hi @Dhishyanth. You can delete the vm and ...READ MORE

answered Dec 18, 2019 in Azure by Kalgi
• 51,970 points
925 views
0 votes
1 answer

How to create a windows virtual machine on Azure?

Azure virtual machines (VMs) can be created ...READ MORE

answered Jan 10 in Azure by Sirajul
• 58,210 points
351 views
0 votes
1 answer

How to add co-admin to an azure subscription?

To assign a user as an administrator Sign ...READ MORE

answered Jan 23 in Azure by Sirajul
• 58,210 points
541 views
0 votes
1 answer

How to create an image from an existing disk in Azure?

Hi@akhtar, Sometimes we need to create a custom ...READ MORE

answered Nov 13 in Azure by MD
• 79,930 points
15 views
0 votes
1 answer

How to create a snapshot by copying an existing disk in Azure?

Hi@akhtar, Azure Managed Disk snapshots are used to create a point ...READ MORE

answered Nov 16 in Azure by MD
• 79,930 points
12 views
0 votes
1 answer

How to update an existing Kubernetes cluster with new service principal in Azure?

Hi@akhtar, Sometimes it is required to update the ...READ MORE

answered Nov 17 in Azure by MD
• 79,930 points
48 views
+1 vote
2 answers

How do I establish an connection to Azure IoT Hub? Say a connection like MQTT/AMQP using Python.

Azure IoT Hub comes with 3 SDK's: Service SDK Device ...READ MORE

answered Apr 13, 2018 in Azure by null_void
• 3,220 points
993 views
0 votes
1 answer

How to determine the number of messages in an Azure Services Bus Queue?

You will get error when you try ...READ MORE

answered Jun 12, 2018 in Azure by null_void
• 3,220 points
1,832 views