azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

There is no mention to dynamic resources as one VMSS

Open otero16 opened this issue 1 year ago • 2 comments

Type of issue

Missing information

Feedback

We have dynamic elements such as one VMSS that can scale up or down, i am looking for a way to add this resource as the backend pool for one appgw, however using static ip addresses or fqdn is not working, when i scale my vmss the app gw is not capable of pointing to the new instances as the IP addresses have changed. Can you please explain how can we add one dynamic VMSS as the backend for AppGw??

Page URL

https://learn.microsoft.com/en-us/powershell/module/az.network/add-azapplicationgatewaybackendaddresspool?view=azps-12.4.0&viewFallbackFrom=azps-12.2.0

Content source URL

https://github.com/Azure/azure-powershell/blob/main/src/Network/Network/help/Add-AzApplicationGatewayBackendAddressPool.md

Author

@mikefrobbins

Document Id

9c13c173-3db9-d11f-b9de-c45d4d1431dc

otero16 avatar Oct 08 '24 07:10 otero16

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @TravisCragg-MSFT, @sandeepraichura.

Agreed, adding instances individually would be a pain. Instead, I would update the scale set virtualMachineProfile.networkProfile to add the backendpool of the AppGw in the model. In powershell, that looks something like:

# Find the backend address pool in the application gateway
$backendAddressPool = $appGw.BackendAddressPools | Where-Object { $_.Name -eq $backendAddressPoolName }

# Add the backend address pool to the VMSS
$vmss.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations[0].IpConfigurations[0].ApplicationGatewayBackendAddressPools += $backendAddressPool

# : Update the VMSS
Update-AzVmss -ResourceGroupName $resourceGroupName -Name $vmssName -VirtualMachineScaleSet $vmss

So that updates the scale set model. Any new instances will be added to the AppGw backend pool. Existing instances will be updated depending on the upgrade policy: https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-upgrade-policy

fitzgeraldsteele avatar Oct 11 '24 17:10 fitzgeraldsteele

Hello, @otero16, do you have any more questions around this or has this been resolved?

Kanik09 avatar Dec 18 '24 06:12 Kanik09