none
Azure Application Gateway - How to set backend pool target type using RM power shell RRS feed

All replies

  • Greetings,

    You can add backend pools to an application gateway using IP address or FQDN. Any resource can be added to this pool using those two parameters.Could you please let us know what type of resource are you trying to add to this pool?

    Regards,
    Subhash




    Wednesday, October 16, 2019 10:48 AM
    Moderator
  • hi Subhash,

    Thank you for the comment 

    I am trying to use target type as "VMSS"  and target will be "XYZ "

    Regards,

    Shibin KM 


    Wednesday, October 16, 2019 11:14 AM
  • You can try this powershell script to add VMSS to the backend pool of Application gateway.
    Wednesday, October 16, 2019 11:37 AM
    Moderator
  • Hi  ,

    Looking for azure RM module script.

    Regards,

    Shibin KM 

    Wednesday, October 16, 2019 11:42 AM
  • Hello,

    It looks like there is an issue with Update-AzVmss powershell command due to some format issues. I will be working on this and will update you.Also will provide you the Azure RM module script.

    Regards,
    Subhash


    Monday, October 21, 2019 5:55 AM
    Moderator
  • Hi, I found a following document.

    https://github.com/MicrosoftDocs/azure-docs/blob/8a5d4411b01e0da330948fbf3d76c9747c74ef95/articles/application-gateway/quick-create-powershell.md

    It contains how to create backendPool using Azure RM Module.

    ===

    $backendPool = New-AzureRmApplicationGatewayBackendAddressPool `
      -Name myAGBackendPool `
      -BackendIPAddresses $address1.ipconfigurations[0].privateipaddress, $address2.ipconfigurations[0].privateipaddress
    $poolSettings = New-AzureRmApplicationGatewayBackendHttpSettings `
      -Name myPoolSettings `
      -Port 80 `
      -Protocol Http `
      -CookieBasedAffinity Enabled `
      -RequestTimeout 120

    ===

    By the way, The latest version is blow.

    https://docs.microsoft.com/ja-jp/azure/application-gateway/quick-create-powershell

    Monday, October 21, 2019 9:10 AM
  • hi,

    I am not able to set application gateway backend pool target filed using powershell script / arm template .

    both the filed have proper value and i am able to set through manually not through script. Is there  is any proper script for that ?

    same has not reflecting anywhere in arm template also .

    Regards,

    Shibin KM 

    Tuesday, October 22, 2019 5:12 AM
  • Hello,

    The script you are referring above cannot add VMSS to the pool. It is for standard azure services which can be communicated through FQDN's and IP's. We cannot directly assign a VMSS to backend pool of application gateway.We need to add the properties of the backend pool to the properties of the VMSS and update it so that it can be added to the backend pool logically and indirectly. I am working on the same to achieve and stuck up at updating due to parsing error. The Azure VMSS was unable to take LIST and failing in parsing. So, i working towards fixing it. I will update you once it is done.

    Regards,
    Subhash 

    Tuesday, October 22, 2019 5:16 AM
    Moderator
  • Hello,

    Referring to this earlier thread.The script you are referring there cannot add VMSS to the pool. It is for standard azure services which can be communicated through FQDN's and IP's. We cannot directly assign a VMSS to backend pool of application gateway.We need to add the properties of the backend pool to the properties of the VMSS and update it so that it can be added to the backend pool logically and indirectly. I am working on the same to achieve and stuck up at updating the VMSS due to parsing error. The Azure VMSS was unable to take LIST and failing in parsing. So, i working towards fixing it. I will update you once it is done.

    Note : There is no specific target parameter in powershell here for selecting the targets for backend pool as we do in portal. We can achieve adding VMSS to the backend pool as mentioned above. 
    Regards,
    Subhash

    Tuesday, October 22, 2019 5:30 AM
    Moderator
  • Hi , 

    Thank you for the update, when i can expect the same ?

    Even its not working using ARM template  .

    Regards,

    Shibin KM 



    Tuesday, October 22, 2019 5:55 AM
  • Hi, 

    Create a dummy Backend pool for Application gateway without any target. Then use the below script to get the VMSS added to the Backend pool of Application Gateway. 

    $vmssname = "VMSS"
    $Rg= "msrini-WANLAB"
    $ID = "/subscriptions/XXXX/resourceGroups/msrini-WANLAB/providers/Microsoft.Network/applicationGateways/testVMSS/backendAddressPools/YYYY"
    $a=Get-AzVmss -ResourceGroupName $Rg -VMScaleSetName $vmssname
    $a.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations[0].IpConfigurations[0].ApplicationGatewayBackendAddressPools = $null
    Update-AzVmss -ResourceGroupName $Rg -VirtualMachineScaleSet $a -VMScaleSetName $vmssname
    
    
    
    $a=Get-AzVmss -ResourceGroupName $Rg -VMScaleSetName $vmssname
    $test =  @{ Id = $ID }
    $a.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations[0].IpConfigurations[0].ApplicationGatewayBackendAddressPools= New-Object System.Collections.Generic.List[Microsoft.Azure.Management.Compute.Models.SubResource]
    $a.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations[0].IpConfigurations[0].ApplicationGatewayBackendAddressPools.Add($test)
    Update-AzVmss -ResourceGroupName $Rg -VirtualMachineScaleSet $a -VMScaleSetName $vmssname -Debug
    
    $a=Get-AzVmss -ResourceGroupName $Rg -VMScaleSetName $vmssname
    
    Get-AzVmssVM -ResourceGroupName $Rg -VMScaleSetName $vmssname
    
    #Note dowm the InstanceID and use it in the next commands. 
    
    Update-AzVmssInstance -ResourceGroupName $Rg -VMScaleSetName $vmssname -InstanceId 0
    Update-AzVmssInstance -ResourceGroupName $Rg -VMScaleSetName $vmssname -InstanceId 3

    Let me know if you have any questions. 

    Regards, 

    Msrini


    Wednesday, October 23, 2019 9:30 AM
    Moderator
  • Hi, 

    You first run the below command

    Get-AzVmssVM -ResourceGroupName $Rg -VMScaleSetName $vmssname

    With the output, you can get the Instance ID. In my case the ID is 0 and 3. 

    Update-AzVmssInstance -ResourceGroupName $Rg -VMScaleSetName $vmssname -InstanceId 0
    Update-AzVmssInstance -ResourceGroupName $Rg -VMScaleSetName $vmssname -InstanceId 3

    The error which you are receiving is because you used $vmssnam instead of $vmssname. 

    Also use Update-AzvmssInstance command instead of UPdate-Azvmss

    Let me know if this works for you. 

    Regards, 

    Msrini

    Thursday, October 24, 2019 6:14 AM
    Moderator
  • Hi , 

    I am getting issue on last line .

    Update-AzVmssInstance -ResourceGroupName $Rg -VMScaleSetName $vmssname -InstanceId 0

    Update-AzVmssInstance : Operation 'manualUpgrade' is only allowed on Virtual Machine Scale Set 'IntelNode' with 'Manual' UpgradeMode.
    ErrorCode: OperationNotAllowed
    ErrorMessage: Operation 'manualUpgrade' is only allowed on Virtual Machine Scale Set 'IntelNode' with 'Manual' UpgradeMode.
    ErrorTarget:
    StatusCode: 409

    Regards,

    Shibin KM 

    Thursday, October 24, 2019 6:18 AM
  • Hi, 

    You need to change the upgrade policy to manual. 

    If this response is helpful, can you please mark it as answer. 

    Regards, 

    Msrini

    Thursday, October 24, 2019 6:25 AM
    Moderator
  • Hi,

    its not allowing to upgrade , getting below error 

    Failed to update virtual machine scale set 'XYZ'. Error: Virtual Machine Scale Sets with extension Microsoft.Azure.ServiceFabric.ServiceFabricNode must be set to automatic upgrade mode.

    Regards

    Shibin KM

    Thursday, October 24, 2019 9:30 AM
  • Hi, 

    Found a similar thread in SO on why you are getting the above error: https://stackoverflow.com/questions/42419437/how-to-change-primary-node-type-in-service-fabric

    You need to change the durability level to Gold. 

    Reference: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-cluster-capacity#the-durability-characteristics-of-the-cluster

    Regards, 

    Msrini

    Thursday, October 24, 2019 10:32 AM
    Moderator
  • Hi, 

    Just checking in if you have had a chance to see the previous response. If this answers your query, do click “Mark as Answer” and Up-Vote for the same.

    Regards, 

    Msrini

    Friday, November 1, 2019 1:25 PM
    Moderator