Azure Application Gateway 502 error












4















I being working with the Azure application gateway, and stuck at the following error.
Here, my Network Diagram
App Gateway with cloud service



Here, the powershell script which I had configure
Poweshell Output
PS C:Usersshabbir.akolawala> Get-AzureApplicationGateway sbr2appgateway



Name          : sbr2appgateway
Description :
VnetName : Group Shabs-AppGateway2 sbag2vnet
Subnets : {sbag2subnet1}
InstanceCount : 2
GatewaySize : Small
State : Running
VirtualIPs : {104.41.159.238} <-- Note IP Here
DnsName : 01b9b0e4-4cd2-4437-b641-0b5dc4e3efe7.cloudapp.net


Here, public IP of the application gateway is 104.41.159.238
Now, if I hit for first time you hit the gateway, you get following output
Note, this website doesn't render correctly, as many request (css/images) fail with 502.



First Response from the Gateway



Now, when if I hit this second time, I straightway get the 502 error



enter image description here



But, when hit the cloud service IP, I get my website correctly



Website render correct with Cloud service



I had configure the Azure Gateway with following configuration XML



My Questions are,



1] Does one have an idea how how to access logs which are generated in Application Gateway (In theory, Application gateway runs on IIS 8.5 / ARR)



2] Any obvious error, I made in design or configuration?










share|improve this question

























  • Did you ever solve this? I am in the exact same situation, and getting the exact same error. But have found no solution, and no way to find what the actual error is.

    – Wedge
    Mar 11 '16 at 1:14











  • Nope, But I got clue about the health probes. When hit the first time, application gateway initiate the health probe, reckon the second time you hit the service, the app gateway has removed the server from the pool hence immediately returning a 502.

    – Shabbir
    Mar 14 '16 at 4:39













  • When contact Microsoft for troubleshooting, here is the reply I got Service as it stands at the moment does not expose any logs or diagnostics. If depth troubleshooting help is required, we will need to look into raising an advisory ticket

    – Shabbir
    Mar 14 '16 at 4:42













  • Yes I figured it out. It was caused by the health probe. My app requires authentication, but it seems like the probe is only able to make an anonymous connection. So the probe was always getting an error status, and removed all the servers from the pool. So I configured a path that allows anonymous, and created a custom probe to point to that, and now it all works

    – Wedge
    Mar 14 '16 at 23:49








  • 1





    our team is stuck on this exact same 502 error

    – abhi
    Feb 23 '18 at 0:39
















4















I being working with the Azure application gateway, and stuck at the following error.
Here, my Network Diagram
App Gateway with cloud service



Here, the powershell script which I had configure
Poweshell Output
PS C:Usersshabbir.akolawala> Get-AzureApplicationGateway sbr2appgateway



Name          : sbr2appgateway
Description :
VnetName : Group Shabs-AppGateway2 sbag2vnet
Subnets : {sbag2subnet1}
InstanceCount : 2
GatewaySize : Small
State : Running
VirtualIPs : {104.41.159.238} <-- Note IP Here
DnsName : 01b9b0e4-4cd2-4437-b641-0b5dc4e3efe7.cloudapp.net


Here, public IP of the application gateway is 104.41.159.238
Now, if I hit for first time you hit the gateway, you get following output
Note, this website doesn't render correctly, as many request (css/images) fail with 502.



First Response from the Gateway



Now, when if I hit this second time, I straightway get the 502 error



enter image description here



But, when hit the cloud service IP, I get my website correctly



Website render correct with Cloud service



I had configure the Azure Gateway with following configuration XML



My Questions are,



1] Does one have an idea how how to access logs which are generated in Application Gateway (In theory, Application gateway runs on IIS 8.5 / ARR)



2] Any obvious error, I made in design or configuration?










share|improve this question

























  • Did you ever solve this? I am in the exact same situation, and getting the exact same error. But have found no solution, and no way to find what the actual error is.

    – Wedge
    Mar 11 '16 at 1:14











  • Nope, But I got clue about the health probes. When hit the first time, application gateway initiate the health probe, reckon the second time you hit the service, the app gateway has removed the server from the pool hence immediately returning a 502.

    – Shabbir
    Mar 14 '16 at 4:39













  • When contact Microsoft for troubleshooting, here is the reply I got Service as it stands at the moment does not expose any logs or diagnostics. If depth troubleshooting help is required, we will need to look into raising an advisory ticket

    – Shabbir
    Mar 14 '16 at 4:42













  • Yes I figured it out. It was caused by the health probe. My app requires authentication, but it seems like the probe is only able to make an anonymous connection. So the probe was always getting an error status, and removed all the servers from the pool. So I configured a path that allows anonymous, and created a custom probe to point to that, and now it all works

    – Wedge
    Mar 14 '16 at 23:49








  • 1





    our team is stuck on this exact same 502 error

    – abhi
    Feb 23 '18 at 0:39














4












4








4


1






I being working with the Azure application gateway, and stuck at the following error.
Here, my Network Diagram
App Gateway with cloud service



Here, the powershell script which I had configure
Poweshell Output
PS C:Usersshabbir.akolawala> Get-AzureApplicationGateway sbr2appgateway



Name          : sbr2appgateway
Description :
VnetName : Group Shabs-AppGateway2 sbag2vnet
Subnets : {sbag2subnet1}
InstanceCount : 2
GatewaySize : Small
State : Running
VirtualIPs : {104.41.159.238} <-- Note IP Here
DnsName : 01b9b0e4-4cd2-4437-b641-0b5dc4e3efe7.cloudapp.net


Here, public IP of the application gateway is 104.41.159.238
Now, if I hit for first time you hit the gateway, you get following output
Note, this website doesn't render correctly, as many request (css/images) fail with 502.



First Response from the Gateway



Now, when if I hit this second time, I straightway get the 502 error



enter image description here



But, when hit the cloud service IP, I get my website correctly



Website render correct with Cloud service



I had configure the Azure Gateway with following configuration XML



My Questions are,



1] Does one have an idea how how to access logs which are generated in Application Gateway (In theory, Application gateway runs on IIS 8.5 / ARR)



2] Any obvious error, I made in design or configuration?










share|improve this question
















I being working with the Azure application gateway, and stuck at the following error.
Here, my Network Diagram
App Gateway with cloud service



Here, the powershell script which I had configure
Poweshell Output
PS C:Usersshabbir.akolawala> Get-AzureApplicationGateway sbr2appgateway



Name          : sbr2appgateway
Description :
VnetName : Group Shabs-AppGateway2 sbag2vnet
Subnets : {sbag2subnet1}
InstanceCount : 2
GatewaySize : Small
State : Running
VirtualIPs : {104.41.159.238} <-- Note IP Here
DnsName : 01b9b0e4-4cd2-4437-b641-0b5dc4e3efe7.cloudapp.net


Here, public IP of the application gateway is 104.41.159.238
Now, if I hit for first time you hit the gateway, you get following output
Note, this website doesn't render correctly, as many request (css/images) fail with 502.



First Response from the Gateway



Now, when if I hit this second time, I straightway get the 502 error



enter image description here



But, when hit the cloud service IP, I get my website correctly



Website render correct with Cloud service



I had configure the Azure Gateway with following configuration XML



My Questions are,



1] Does one have an idea how how to access logs which are generated in Application Gateway (In theory, Application gateway runs on IIS 8.5 / ARR)



2] Any obvious error, I made in design or configuration?







azure gateway






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 16 '16 at 6:20







Shabbir

















asked Feb 10 '16 at 9:24









ShabbirShabbir

131314




131314













  • Did you ever solve this? I am in the exact same situation, and getting the exact same error. But have found no solution, and no way to find what the actual error is.

    – Wedge
    Mar 11 '16 at 1:14











  • Nope, But I got clue about the health probes. When hit the first time, application gateway initiate the health probe, reckon the second time you hit the service, the app gateway has removed the server from the pool hence immediately returning a 502.

    – Shabbir
    Mar 14 '16 at 4:39













  • When contact Microsoft for troubleshooting, here is the reply I got Service as it stands at the moment does not expose any logs or diagnostics. If depth troubleshooting help is required, we will need to look into raising an advisory ticket

    – Shabbir
    Mar 14 '16 at 4:42













  • Yes I figured it out. It was caused by the health probe. My app requires authentication, but it seems like the probe is only able to make an anonymous connection. So the probe was always getting an error status, and removed all the servers from the pool. So I configured a path that allows anonymous, and created a custom probe to point to that, and now it all works

    – Wedge
    Mar 14 '16 at 23:49








  • 1





    our team is stuck on this exact same 502 error

    – abhi
    Feb 23 '18 at 0:39



















  • Did you ever solve this? I am in the exact same situation, and getting the exact same error. But have found no solution, and no way to find what the actual error is.

    – Wedge
    Mar 11 '16 at 1:14











  • Nope, But I got clue about the health probes. When hit the first time, application gateway initiate the health probe, reckon the second time you hit the service, the app gateway has removed the server from the pool hence immediately returning a 502.

    – Shabbir
    Mar 14 '16 at 4:39













  • When contact Microsoft for troubleshooting, here is the reply I got Service as it stands at the moment does not expose any logs or diagnostics. If depth troubleshooting help is required, we will need to look into raising an advisory ticket

    – Shabbir
    Mar 14 '16 at 4:42













  • Yes I figured it out. It was caused by the health probe. My app requires authentication, but it seems like the probe is only able to make an anonymous connection. So the probe was always getting an error status, and removed all the servers from the pool. So I configured a path that allows anonymous, and created a custom probe to point to that, and now it all works

    – Wedge
    Mar 14 '16 at 23:49








  • 1





    our team is stuck on this exact same 502 error

    – abhi
    Feb 23 '18 at 0:39

















Did you ever solve this? I am in the exact same situation, and getting the exact same error. But have found no solution, and no way to find what the actual error is.

– Wedge
Mar 11 '16 at 1:14





Did you ever solve this? I am in the exact same situation, and getting the exact same error. But have found no solution, and no way to find what the actual error is.

– Wedge
Mar 11 '16 at 1:14













Nope, But I got clue about the health probes. When hit the first time, application gateway initiate the health probe, reckon the second time you hit the service, the app gateway has removed the server from the pool hence immediately returning a 502.

– Shabbir
Mar 14 '16 at 4:39







Nope, But I got clue about the health probes. When hit the first time, application gateway initiate the health probe, reckon the second time you hit the service, the app gateway has removed the server from the pool hence immediately returning a 502.

– Shabbir
Mar 14 '16 at 4:39















When contact Microsoft for troubleshooting, here is the reply I got Service as it stands at the moment does not expose any logs or diagnostics. If depth troubleshooting help is required, we will need to look into raising an advisory ticket

– Shabbir
Mar 14 '16 at 4:42







When contact Microsoft for troubleshooting, here is the reply I got Service as it stands at the moment does not expose any logs or diagnostics. If depth troubleshooting help is required, we will need to look into raising an advisory ticket

– Shabbir
Mar 14 '16 at 4:42















Yes I figured it out. It was caused by the health probe. My app requires authentication, but it seems like the probe is only able to make an anonymous connection. So the probe was always getting an error status, and removed all the servers from the pool. So I configured a path that allows anonymous, and created a custom probe to point to that, and now it all works

– Wedge
Mar 14 '16 at 23:49







Yes I figured it out. It was caused by the health probe. My app requires authentication, but it seems like the probe is only able to make an anonymous connection. So the probe was always getting an error status, and removed all the servers from the pool. So I configured a path that allows anonymous, and created a custom probe to point to that, and now it all works

– Wedge
Mar 14 '16 at 23:49






1




1





our team is stuck on this exact same 502 error

– abhi
Feb 23 '18 at 0:39





our team is stuck on this exact same 502 error

– abhi
Feb 23 '18 at 0:39












3 Answers
3






active

oldest

votes


















5














It it because of timeout.
1, Probe has by default 30 seconds timeout. if you application needs authentication, you will have to set custom probe.



2, Application Gateway has default 30 seconds timeout as well. if your Application Gateway cannot get response from backend virtual machine. it will return HTTP 502. it can be changed via "RequestTimeout" configuration item.



PowerShell:



  set-AzureApplicationGatewayConfig -Name <application gateway name> -    Configfile "<path to file>"


Config file:



 <BackendHttpSettings>
<Name>setting1</Name>
<Port>80</Port>
<Protocol>Http</Protocol>
<CookieBasedAffinity>Enabled</CookieBasedAffinity>
<RequestTimeout>120</RequestTimeout>
<Probe>Probe01</Probe>


For detail : https://azure.microsoft.com/en-us/documentation/articles/application-gateway-create-probe-classic-ps/






share|improve this answer


























  • I've added a a Resource Manager version of your response.

    – Frank Fu
    Nov 20 '18 at 2:27



















0














I created custom healthchecks, but never seen attempts in websever access-log.
So I just set route on backend to serve any domain including IP address and add htpasswd protection to real domains.
Azure application gateway check http://backend_ip:80/ and became happy gateway :)






share|improve this answer































    0














    Just extending this @Lang's answer for people using the Resource Manager rather than Classic. The following Powershell script will update set a new requested timeout of 120 seconds for every BackendHttpSetting within the target app gateway.





    # Variable setup
    $agName = "my gateway name"
    $rgName = "my resource group name"
    $newRequestTimeout = 120

    # Retrieve gateway obj
    $appGW = Get-AzureRmApplicationGateway -Name $agName -ResourceGroupName $rgName
    $allHttpBackendSettings = Get-AzureRmApplicationGatewayBackendHttpSettings `
    -ApplicationGateway $appGW

    foreach($s in $allHttpBackendSettings)
    {
    # Retreive existing probe
    $probeName = $s.Probe.Id.Split("/") | Select-Object -Last 1;
    $probe = Get-AzureRmApplicationGatewayProbeConfig -ApplicationGateway $appGW `
    -Name $probeName

    # Update http settings
    $appGW = Set-AzureRmApplicationGatewayBackendHttpSettings -ApplicationGateway $appGW `
    -Name $s.Name -RequestTimeout $newRequestTimeout -Port $s.Port -Protocol $s.Protocol `
    -Probe $probe -CookieBasedAffinity Enabled -PickHostNameFromBackendAddress
    }

    # Persist changes to the App Gateway
    Set-AzureRmApplicationGateway -ApplicationGateway $appGW





    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f35311136%2fazure-application-gateway-502-error%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      5














      It it because of timeout.
      1, Probe has by default 30 seconds timeout. if you application needs authentication, you will have to set custom probe.



      2, Application Gateway has default 30 seconds timeout as well. if your Application Gateway cannot get response from backend virtual machine. it will return HTTP 502. it can be changed via "RequestTimeout" configuration item.



      PowerShell:



        set-AzureApplicationGatewayConfig -Name <application gateway name> -    Configfile "<path to file>"


      Config file:



       <BackendHttpSettings>
      <Name>setting1</Name>
      <Port>80</Port>
      <Protocol>Http</Protocol>
      <CookieBasedAffinity>Enabled</CookieBasedAffinity>
      <RequestTimeout>120</RequestTimeout>
      <Probe>Probe01</Probe>


      For detail : https://azure.microsoft.com/en-us/documentation/articles/application-gateway-create-probe-classic-ps/






      share|improve this answer


























      • I've added a a Resource Manager version of your response.

        – Frank Fu
        Nov 20 '18 at 2:27
















      5














      It it because of timeout.
      1, Probe has by default 30 seconds timeout. if you application needs authentication, you will have to set custom probe.



      2, Application Gateway has default 30 seconds timeout as well. if your Application Gateway cannot get response from backend virtual machine. it will return HTTP 502. it can be changed via "RequestTimeout" configuration item.



      PowerShell:



        set-AzureApplicationGatewayConfig -Name <application gateway name> -    Configfile "<path to file>"


      Config file:



       <BackendHttpSettings>
      <Name>setting1</Name>
      <Port>80</Port>
      <Protocol>Http</Protocol>
      <CookieBasedAffinity>Enabled</CookieBasedAffinity>
      <RequestTimeout>120</RequestTimeout>
      <Probe>Probe01</Probe>


      For detail : https://azure.microsoft.com/en-us/documentation/articles/application-gateway-create-probe-classic-ps/






      share|improve this answer


























      • I've added a a Resource Manager version of your response.

        – Frank Fu
        Nov 20 '18 at 2:27














      5












      5








      5







      It it because of timeout.
      1, Probe has by default 30 seconds timeout. if you application needs authentication, you will have to set custom probe.



      2, Application Gateway has default 30 seconds timeout as well. if your Application Gateway cannot get response from backend virtual machine. it will return HTTP 502. it can be changed via "RequestTimeout" configuration item.



      PowerShell:



        set-AzureApplicationGatewayConfig -Name <application gateway name> -    Configfile "<path to file>"


      Config file:



       <BackendHttpSettings>
      <Name>setting1</Name>
      <Port>80</Port>
      <Protocol>Http</Protocol>
      <CookieBasedAffinity>Enabled</CookieBasedAffinity>
      <RequestTimeout>120</RequestTimeout>
      <Probe>Probe01</Probe>


      For detail : https://azure.microsoft.com/en-us/documentation/articles/application-gateway-create-probe-classic-ps/






      share|improve this answer















      It it because of timeout.
      1, Probe has by default 30 seconds timeout. if you application needs authentication, you will have to set custom probe.



      2, Application Gateway has default 30 seconds timeout as well. if your Application Gateway cannot get response from backend virtual machine. it will return HTTP 502. it can be changed via "RequestTimeout" configuration item.



      PowerShell:



        set-AzureApplicationGatewayConfig -Name <application gateway name> -    Configfile "<path to file>"


      Config file:



       <BackendHttpSettings>
      <Name>setting1</Name>
      <Port>80</Port>
      <Protocol>Http</Protocol>
      <CookieBasedAffinity>Enabled</CookieBasedAffinity>
      <RequestTimeout>120</RequestTimeout>
      <Probe>Probe01</Probe>


      For detail : https://azure.microsoft.com/en-us/documentation/articles/application-gateway-create-probe-classic-ps/







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Mar 29 '16 at 22:59

























      answered Mar 25 '16 at 6:56









      LangLang

      513




      513













      • I've added a a Resource Manager version of your response.

        – Frank Fu
        Nov 20 '18 at 2:27



















      • I've added a a Resource Manager version of your response.

        – Frank Fu
        Nov 20 '18 at 2:27

















      I've added a a Resource Manager version of your response.

      – Frank Fu
      Nov 20 '18 at 2:27





      I've added a a Resource Manager version of your response.

      – Frank Fu
      Nov 20 '18 at 2:27













      0














      I created custom healthchecks, but never seen attempts in websever access-log.
      So I just set route on backend to serve any domain including IP address and add htpasswd protection to real domains.
      Azure application gateway check http://backend_ip:80/ and became happy gateway :)






      share|improve this answer




























        0














        I created custom healthchecks, but never seen attempts in websever access-log.
        So I just set route on backend to serve any domain including IP address and add htpasswd protection to real domains.
        Azure application gateway check http://backend_ip:80/ and became happy gateway :)






        share|improve this answer


























          0












          0








          0







          I created custom healthchecks, but never seen attempts in websever access-log.
          So I just set route on backend to serve any domain including IP address and add htpasswd protection to real domains.
          Azure application gateway check http://backend_ip:80/ and became happy gateway :)






          share|improve this answer













          I created custom healthchecks, but never seen attempts in websever access-log.
          So I just set route on backend to serve any domain including IP address and add htpasswd protection to real domains.
          Azure application gateway check http://backend_ip:80/ and became happy gateway :)







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered May 17 '17 at 21:15









          Fedor ZakharovFedor Zakharov

          1




          1























              0














              Just extending this @Lang's answer for people using the Resource Manager rather than Classic. The following Powershell script will update set a new requested timeout of 120 seconds for every BackendHttpSetting within the target app gateway.





              # Variable setup
              $agName = "my gateway name"
              $rgName = "my resource group name"
              $newRequestTimeout = 120

              # Retrieve gateway obj
              $appGW = Get-AzureRmApplicationGateway -Name $agName -ResourceGroupName $rgName
              $allHttpBackendSettings = Get-AzureRmApplicationGatewayBackendHttpSettings `
              -ApplicationGateway $appGW

              foreach($s in $allHttpBackendSettings)
              {
              # Retreive existing probe
              $probeName = $s.Probe.Id.Split("/") | Select-Object -Last 1;
              $probe = Get-AzureRmApplicationGatewayProbeConfig -ApplicationGateway $appGW `
              -Name $probeName

              # Update http settings
              $appGW = Set-AzureRmApplicationGatewayBackendHttpSettings -ApplicationGateway $appGW `
              -Name $s.Name -RequestTimeout $newRequestTimeout -Port $s.Port -Protocol $s.Protocol `
              -Probe $probe -CookieBasedAffinity Enabled -PickHostNameFromBackendAddress
              }

              # Persist changes to the App Gateway
              Set-AzureRmApplicationGateway -ApplicationGateway $appGW





              share|improve this answer




























                0














                Just extending this @Lang's answer for people using the Resource Manager rather than Classic. The following Powershell script will update set a new requested timeout of 120 seconds for every BackendHttpSetting within the target app gateway.





                # Variable setup
                $agName = "my gateway name"
                $rgName = "my resource group name"
                $newRequestTimeout = 120

                # Retrieve gateway obj
                $appGW = Get-AzureRmApplicationGateway -Name $agName -ResourceGroupName $rgName
                $allHttpBackendSettings = Get-AzureRmApplicationGatewayBackendHttpSettings `
                -ApplicationGateway $appGW

                foreach($s in $allHttpBackendSettings)
                {
                # Retreive existing probe
                $probeName = $s.Probe.Id.Split("/") | Select-Object -Last 1;
                $probe = Get-AzureRmApplicationGatewayProbeConfig -ApplicationGateway $appGW `
                -Name $probeName

                # Update http settings
                $appGW = Set-AzureRmApplicationGatewayBackendHttpSettings -ApplicationGateway $appGW `
                -Name $s.Name -RequestTimeout $newRequestTimeout -Port $s.Port -Protocol $s.Protocol `
                -Probe $probe -CookieBasedAffinity Enabled -PickHostNameFromBackendAddress
                }

                # Persist changes to the App Gateway
                Set-AzureRmApplicationGateway -ApplicationGateway $appGW





                share|improve this answer


























                  0












                  0








                  0







                  Just extending this @Lang's answer for people using the Resource Manager rather than Classic. The following Powershell script will update set a new requested timeout of 120 seconds for every BackendHttpSetting within the target app gateway.





                  # Variable setup
                  $agName = "my gateway name"
                  $rgName = "my resource group name"
                  $newRequestTimeout = 120

                  # Retrieve gateway obj
                  $appGW = Get-AzureRmApplicationGateway -Name $agName -ResourceGroupName $rgName
                  $allHttpBackendSettings = Get-AzureRmApplicationGatewayBackendHttpSettings `
                  -ApplicationGateway $appGW

                  foreach($s in $allHttpBackendSettings)
                  {
                  # Retreive existing probe
                  $probeName = $s.Probe.Id.Split("/") | Select-Object -Last 1;
                  $probe = Get-AzureRmApplicationGatewayProbeConfig -ApplicationGateway $appGW `
                  -Name $probeName

                  # Update http settings
                  $appGW = Set-AzureRmApplicationGatewayBackendHttpSettings -ApplicationGateway $appGW `
                  -Name $s.Name -RequestTimeout $newRequestTimeout -Port $s.Port -Protocol $s.Protocol `
                  -Probe $probe -CookieBasedAffinity Enabled -PickHostNameFromBackendAddress
                  }

                  # Persist changes to the App Gateway
                  Set-AzureRmApplicationGateway -ApplicationGateway $appGW





                  share|improve this answer













                  Just extending this @Lang's answer for people using the Resource Manager rather than Classic. The following Powershell script will update set a new requested timeout of 120 seconds for every BackendHttpSetting within the target app gateway.





                  # Variable setup
                  $agName = "my gateway name"
                  $rgName = "my resource group name"
                  $newRequestTimeout = 120

                  # Retrieve gateway obj
                  $appGW = Get-AzureRmApplicationGateway -Name $agName -ResourceGroupName $rgName
                  $allHttpBackendSettings = Get-AzureRmApplicationGatewayBackendHttpSettings `
                  -ApplicationGateway $appGW

                  foreach($s in $allHttpBackendSettings)
                  {
                  # Retreive existing probe
                  $probeName = $s.Probe.Id.Split("/") | Select-Object -Last 1;
                  $probe = Get-AzureRmApplicationGatewayProbeConfig -ApplicationGateway $appGW `
                  -Name $probeName

                  # Update http settings
                  $appGW = Set-AzureRmApplicationGatewayBackendHttpSettings -ApplicationGateway $appGW `
                  -Name $s.Name -RequestTimeout $newRequestTimeout -Port $s.Port -Protocol $s.Protocol `
                  -Probe $probe -CookieBasedAffinity Enabled -PickHostNameFromBackendAddress
                  }

                  # Persist changes to the App Gateway
                  Set-AzureRmApplicationGateway -ApplicationGateway $appGW






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 20 '18 at 2:26









                  Frank FuFrank Fu

                  1,72011523




                  1,72011523






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f35311136%2fazure-application-gateway-502-error%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      MongoDB - Not Authorized To Execute Command

                      in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

                      How to fix TextFormField cause rebuild widget in Flutter