Windows Web proxy server

AD FS 2012 R2 Web Application Proxy – Re-Establish Proxy Trust

September 1, 2018 – 07:12 am

In the Tailspintoys environment, the administrator (moi) was a bit slack. They let the AD FS 2012 R2 proxy get into a bad state. The AD FS Proxy was not contacting the AD FS server on the internal network, and this allowed the short lived authentication certificate to expire. At this point the AD FS Proxy was “dead to me” as far as the AD FS server was concerned. The internal AD FS server was OK, the issue was just with the proxy.

Bummer.

How do we fix this? Actually before we dive into that, lets see what was going on first. Please note that this post is specific for AD FS 2012 R2. It does not aim to cover AD FS 2.0 or 2.1 at all.

Starting Point – What The AD FS Proxy Saw

On the WAP server, the Remote Access Management Console was not happy. It was reporting error code 0x8007520C.

On the WAP server, EventID 422 was logged into the AD FS Admin log stating that it was unable to retrieve proxy configuration data from the Federation Service. The details in the event stated: System.Net.WebException: The remote server returned an error: (401) Unauthorized.

Starting Point – What AD FS Saw

On the AD FS server EventID 394 indicated what the AD FS server really though about the AD FS proxy:

The proxy trust certificate specified by thumpbrint {0} has expired.

Since the federation server proxy could not renew its trust with the Federation Service, the recommended user action was: To ensure that the federation server proxy is trusted by the Federation Service. If the trust does not exist or has been revoked, establish a trust between the proxy and the Federation Service using the Federation Service Proxy Configuration Wizard by logging on to the proxy computer. This is detailed in EventID 276, which is again logged on the AD FS server.

OK – so we need to re-establish the trust between the AD FS proxy and AD FS server. How do we go about doing that?

Re-Establish AD FS Proxy Trust Using Remote Access Management Console

Interestingly enough there is no option presented initially in the GUI to re-configure the AD FS proxy.

HKLM\Software\Microsoft\ADFS\ProxyConfigurationStatus

We need to set the ProxyConfigurationStatus REG_DWORD to a value of 1 (meaning “not configured”) instead of 2 (“configured”). Once that change is made, re-open the GUI. No reboot is required.

The Remote Access Manager should now allow you to re-run the configuration wizard.

Since there may have been certificate replacement/renewal since the initial server was deployed, be careful to select the correct certificate:

The summary screen indicates the PowerShell code that will be executed. This is also captured later in the post for reference.

And when complete, the trust is now re-established.

Now restart the AD FS service on the Proxy server, and check the AD FS event logs to ensure that they are all green ticky ticky!

Alternatively, this can be done from PowerShell, this is shown below.

Re-Establish AD FS Proxy Trust Using PowerShell

EventID 276 shown above, notes that we can run the Install-WebApplicationProxy cmdlet to re-establish trust between the AD FS server and the WAP. TechNet discusses this in the Install and Configure the Web Application Proxy Server section. The certificate we want to use is already installed onto the server. In my case it has the thumbprint of 3EFF626CD4CAECDB6F84DB5FB4FCF580ACF629E2 – note that yours *WILL* be different.

Note that the username and password were not specified, since the cmdlet knows it needs an account that has permission on the AD FS server and it prompts for this required information. This is the Tailspintoys\administrator account as shown below:

After providing the credentials, the cmdlet does it’s thang:

Finally finishing up with a Deployment Succeeded message.

Checking For Success

After the restarting the AD FS service on the proxy, success messages were then logged on both the AD FS server and the proxy.

On the AD FS proxy EventID 245 noted that the proxy was able to successfully retrieve its configuration:

And on the AD FS server EventID 396 was logged stating that the trust between the proxy and AD FS server was renewed.