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

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.

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

Using VM Scale Sets as Application Gateway Backend

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.

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.

Unable to stop VMs using Azure Automation

We have an Azure Service Fabric cluster set up and I'm attempting to use Azure Automation to stop the virtual machine scale set and restart on a schedule. The scale set is assigned to a resource group as follows
My Exteral_Start_ResourceGroupNames and External_Stop_ResourceGroupNames, which the ScheduledStartStop_Parent runbook uses is as follows:
You can see the resource group name matches the resource group name for my VM scaleset. My understanding is that when the runbook fires, all VMs in this resource group, and, therefore, the VM set, should be stopped. However, when the runbook fires, it's not finding any VMs to stop.
Can anyone see what's wrong?
Although they are both VMs, "Virtual Machines" and "Virtual Machine Scalesets" are different resource types in Azure. The underlying nodes of a scaleset are not exposed as 'normal' VMs. You could probably modify your start/stop script to find scalesets in those resource groups instead of normal VMs.
To get you started: The powershell command for finding ScaleSets is Get-AzureRmVmss. That page also details how to shut them down.

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