Using VM Scale Sets as Application Gateway Backend - azure

I've been trying to use Azure VMSS as my Application Gateway backend but I keep getting this message in my backend pool details page
Virtual machine scale set 'vmss-name' was added to this backend pool. Upgrade all the instances of 'vmss-name' for this change to work.
I don't know which part of the instance should I upgrade. I've tried using a custom image and the official Windows Server 2022 image. Can somebody tell me?
Thanks

It seems that when creating VMSS, we can choose our Upgrade policy under the Management tab. If we chose Manual upgrade mode, we need to manually upgrade our VMSS whenever we introduce a new scale set model. We can use this command in the CloudShell to manually update a VM in the VMSS.
Update-AzVmssInstance -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet" -InstanceId instanceId
If we choose Automatic upgrade mode, our VMSS will automatically update itself whenever we introduce a new scale set model.
Please see the official documentation for further details.

Related

Azure VMSS 10 model limit?

Recently when I update my VMSS model, I received error like
MyVmssName has reached its limit of 10 models that may be referenced
by one or more VMs belonging to the Virtual Machine Scale Set. . Upgrade the VMs to the latest model of the Virtual Machine Scale Set before trying again.
Does Azure have some official documentation on this 10 model limitation? Could not find it anywhere.
I have referred similar Issue:
When a change is made to the VMSS, such as a cluster upgrade, the change must be applied to the existing instances.
If VMSS using the manual upgrade policy. This means that when a change is made, the user must manually update the old instances.
Azure Portal > Impacted VMSS > Instances tab.
The CX can then select each instance which is showing Latest Model as No and upgrade one by one. I would not recommend upgrading all instances at once as this may bring the VMSS down.
Also upgrade VMSS instances using Azure CLI.
if VMSS upgrade policy is set to automatic, instances will upgrade automatically in random order.
You can also upgrade VMSS using Azure CLI.
az vmss update --name <VMSSName> --resource-group <ResourceGroupname> --license-type windows_server
Reference: Update VMSS

Updating Azure Virtual Machine Scale Set

I have hosted a website in azure virtual machine scale set by following the below steps
Create a VM and do the necessary changes/installations in iis.
Create a snapshot of the VM. This ensure that the above instance can be used for future changes.
create a disk from the snapshot.
create a vm from the disk.
RDP to the instance and generalize the instance for deployment (sysprep)
Run %WINDIR%\system32\sysprep\sysprep.exe as admin.
Enter System Out-of-Box Experience (OOBE),
Generalize check box is selected
Shutdown Option = Shutdown
Create Image (capture) from the above instance.
Create VSS from the above image
Suppose their is a change in the web build , Is there a way to update the scale set without following these steps again ?
Azure virtual machine extensions provide capabilities such as post-deployment configuration and management, monitoring, security, and more. Production deployments typically use a combination of multiple extensions configured for the VM instances to achieve desired results.
This is also is a good way to ensure availability of your system. The scale set will apply the update to one VM at a time, leaving the other VMs up and running.
Below example taken from the learn:
Deploy the update by using a custom script extension
In the Azure portal, run the following command to view the current upgrade policy for the scale set:
Azure CLI:
az vmss show \
--name webServerScaleSet \
--resource-group scalesetrg \
--query upgradePolicy.mode
Verify that the upgrade policy is set to Automatic. You specified this policy when you created the scale set in the first lab. If the policy were Manual, you would apply any VM changes by hand. Because the policy is Automatic, you can use the custom script extension and allow the scale set to do the update.
Run the following command to apply the update script:
az vmss extension set \
--publisher Microsoft.Azure.Extensions \
--version 2.0 \
--name CustomScript \
--vmss-name webServerScaleSet \
--resource-group scalesetrg \
--settings "{\"commandToExecute\": \"echo This is the updated app installed on the Virtual Machine Scale Set ! > /var/www/html/index.html\"}"

What's the difference between Update-AzureRmVmss, Update-AzureRmVmssInstance and Update-AzureRmVmssVM?

For the life of me, I can't work out what the differences are between Update-AzureRmVmss, Update-AzureRmVmssInstance and Update-AzureRmVmssVM in relation to Azure Resource Manager (AzureRM), even after reading the documentation.
https://learn.microsoft.com/en-us/powershell/module/azurerm.compute/update-azurermvmss?view=azurermps-6.13.0
I'm looking to run a command that will update all my VMs in my Azure VMSS (virtual machine scale set) regardless of the number of instances. The upgrade policy is set to manual.
You have many VM's in a scale set each VM is referred to as an instance.
In manual mode when you update the scale set model, nothing happens to existing VMs.
To update existing VMs, you must do a "manual upgrade" of each existing VM.
The powershell command is:
Update-AzVmssInstance -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet" -InstanceId instanceId
You must run this command for each VM in your scale set.
If you want to upgrade all VM's with a single command you need to change the upgrade policy to automatic or rolling.

how to disable Accelerated Networking on Azure VM

i have enabled Accelerated Networking on Azure Vm..now i want to disable accelerating networking but unable to find a way. since i want to change the size of vm and accelerating network is preventing to change the size.
please suggest
This is a setting on the network interface. For a single machine you could try running this command from the cloud shell on the azure portal:
az network nic update --accelerated-networking false --name <network interface name> --resource-group <resource group name>
Recommend typing this command out not copy pasting from this page to avoid hyphen hell. Case sensitive so all lower case.
https://learn.microsoft.com/en-us/cli/azure/network/nic?view=azure-cli-latest#az-network-nic-update
For VMSS (Virtual Machine Scale Sets), the process is a bit less straight forward, but still possible.
Say your resource group is RG001 and the VMSS name is VMSS001, then you can issue
az vmss update -g RG001 -n VMSS001 --set virtualMachineProfile.networkProfile.networkInterfaceConfigurations[0].enableAcceleratedNetworking=false
I added a new NIC from the VM networking tab and it seems that accelerated networking is disabled by default. Then I detach the previous NIC (with accelerated networking) and was able to resize my VM.
You could try to use azure powershell to do it.
Remove-AzureRmAcceleratedNIC -ResourceGroupName <ResourceGroupName> -VMName <VMName> -OsType <OsType>
You need to download the script file in this link, then refer to the usage below.
For more details, refer to this link.

How to change the number of target instances in an Azure Virtual Machine Scale Set?

I've created an Azure VMSS and used a target instance count of 1 during my testing. Now that I'm ready to go live for my customer, I really need to change the target instance count to at least 2 for HA reasons. Is there a way to do this via Azure CLI or other means without having to rebuild everything?
Is there a way to do this via Azure CLI or other means without having
to rebuild everything?
Yes, we can use Azure Resource Explorer to configure and update the autoscale setting for a scale set. Azure Resource Explorer is an easy way to manage Azure resources via Resource Manager templates. Here are my steps:
1. login Azure Resource Explorer.
2. switch Read Only to Read/Write.
3. select subscription and resource group, find the vmss and autoscalesettings, then edit it.
4. After edit is complete, select PUT.
5. Then we can find the result from Azure protal.
More information about configure and update the autoscale setting for a scale set, refer to the link.
You can change the capacity of a VM Scale set in the following ways:
Use the Azure portal - Click on your VM scale set and then select the Scaling blade. Use the slider bar.
Use the CLI 2.0 az vmss scale command.
Using Azure PowerShell 5.0.0 or later use this command:
Update-AzureRmVmss -ResourceGroupName myrg -VMScaleSetName myvmss -SkuCapacity 3

Resources