title: Release Management Agent not connecting
body: <p>I'm trying to connect a Deployment Agent to my Release Management server with TFS (all running Update 2).</p>
  
  <p>The Release Management server is outside the network of the test environment servers. It can be reached over HTTP. The test environment is running behind a proxy. I've changed the configuration of the config files to make sure connecting through the proxy works by adding this:</p>
  
  <pre><code>&lt;system.net&gt;
      &lt;defaultProxy enabled="true" 
                    useDefaultCredentials="true"&gt;       
                    &lt;proxy usesystemdefault="True"
                           bypassonlocal="True"/&gt;
    &lt;/defaultProxy&gt;
  &lt;/system.net&gt;
  </code></pre>
  
  <p>I'm using Shadow Accounts to connect the Deployment Agent to the Release Management Server.</p>
  
  <p>When I run the Deployment Agent configuration wizard, everything succeeds. The log file shows no errors. However, when scanning for a new server in the Release Management Client the server doesn't show up.</p>
  
  <p>I've changed the logging to verbose and found the following information in the Deployment Agent log file:</p>
  
  <pre><code>9/3/2014 1:07:37 PM - Information - (3036, 5676) - Service is running under identity: &lt;MACHINENAME&gt;\&lt;USERNAME&gt;
  9/3/2014 1:07:37 PM - Information - (3036, 5676) - Deployer service is starting.
  9/3/2014 1:07:37 PM - Verbose - (3036, 5676) - HeartBeat: Sending HeartBeat
  9/3/2014 1:07:37 PM - Verbose - (3036, 5676) - HeartBeat: Starting Configuration Tests.
  9/3/2014 1:07:37 PM - Verbose - (3036, 5676) - Initializing cache for user &lt;MachineName&gt;\&lt;UserName&gt;.
  9/3/2014 1:07:37 PM - Verbose - (3036, 5676) - Loading profile for user &lt;MachineName&gt;\&lt;UserName&gt;.
  9/3/2014 1:07:37 PM - Verbose - (3036, 5676) - Initializing cache for user &lt;MachineName&gt;\&lt;UserName&gt;.
  9/3/2014 1:07:37 PM - Verbose - (3036, 5676) - Loading profile for user &lt;MachineName&gt;\&lt;UserName&gt;.
  9/3/2014 1:07:37 PM - Verbose - (3036, 5676) - Initializing cache for user &lt;MachineName&gt;\&lt;UserName&gt;.
  9/3/2014 1:07:37 PM - Verbose - (3036, 5676) - Loading profile for user &lt;MachineName&gt;\&lt;UserName&gt;.
  9/3/2014 1:07:37 PM - Verbose - (3036, 5676) - Initializing cache for user &lt;MachineName&gt;\&lt;UserName&gt;.
  9/3/2014 1:07:37 PM - Verbose - (3036, 5676) - Loading profile for user &lt;MachineName&gt;\&lt;UserName&gt;.
  9/3/2014 1:07:37 PM - Verbose - (3036, 5676) - Initializing cache for user &lt;MachineName&gt;\&lt;UserName&gt;.
  9/3/2014 1:07:37 PM - Verbose - (3036, 5676) - Loading profile for user &lt;MachineName&gt;\&lt;UserName&gt;.
  9/3/2014 1:07:37 PM - Verbose - (3036, 5676) - Initializing cache for user &lt;MachineName&gt;\&lt;UserName&gt;.
  9/3/2014 1:07:37 PM - Verbose - (3036, 5676) - Loading profile for user &lt;MachineName&gt;\&lt;UserName&gt;.
  9/3/2014 1:07:37 PM - Information - (3036, 5676) - HeartBeat: Communication Tests terminated. Results are: 
   Test 1 of 7 failed:
  Communication with the Deployment Controller Web Service was not successful. The error received is: Object reference not set to an instance of an object.
  Test 2 of 7 failed:
  Communication with the database through the Deployment Controller Web Service was not successful. The error received during the test is: Object reference not set to an instance of an object.
  Test 3 of 7 failed:
  The account running this Windows Service is not a valid user in the Release Management Server. Please add the user and try again. For cross-domain scenarios using Shadow Accounts, add the local Shadow Account user to the Release Management Server. The error received during the test is: Root element is missing.
  Test 5 of 7 failed:
  Root element is missing.
  Test 6 of 7 failed:
  Root element is missing.
  Test 7 of 7 failed:
  The Deployer user (&lt;MACHINENAME&gt;\&lt;USERNAME&gt;) does not have access to the crypto store. On the server where the deployment agent is installed, navigate to this folder %ALLUSERSPROFILE%\Application Data\Microsoft\Crypto\RSA\MachineKeys and give read/write access to &lt;MACHINENAME&gt;\&lt;USERNAME&gt;.
  
  9/3/2014 1:07:37 PM - Information - (3036, 5676) - HeartBeat: HeartBeat timer is started.
  9/3/2014 1:07:37 PM - Error - (3036, 5676) - Object already exists.
  : \r\n\r\n   at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr)
     at System.Security.Cryptography.Utils._CreateCSP(CspParameters param, Boolean randomKeyContainer, SafeProvHandle&amp; hProv)
     at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
     at System.Security.Cryptography.Utils.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Boolean randomKeyContainer, Int32 dwKeySize, SafeProvHandle&amp; safeProvHandle, SafeKeyHandle&amp; safeKeyHandle)
     at System.Security.Cryptography.RSACryptoServiceProvider.GetKeyPair()
     at Microsoft.TeamFoundation.Release.Data.Helpers.CryptoHelper.GenerateKeySet(String containerName)
     at Microsoft.TeamFoundation.Release.DeploymentAgent.Services.Deployer.DeploymentEventFetcherBase..ctor(Double interval, String dnsName, String serverIpAddress, Action`3 deploymentProcessor, String cryptoContainerName)
     at Microsoft.TeamFoundation.Release.DeploymentAgent.Services.Deployer.DeploymentEventFetcher..ctor(Double interval, String dnsName, String serverIpAddress, Action`3 deploymentProcessor)
     at Microsoft.TeamFoundation.Release.DeploymentAgent.Services.Deployer.DeploymentEventFetcher..ctor(Double interval)
     at Microsoft.TeamFoundation.Release.DeploymentAgent.Service.OnStart(String[] args)
  9/3/2014 1:07:42 PM - Verbose - (3036, 5676) - Initializing cache for user &lt;MachineName&gt;\&lt;UserName&gt;.
  9/3/2014 1:07:42 PM - Verbose - (3036, 5676) - Loading profile for user &lt;MachineName&gt;\&lt;UserName&gt;.
  9/3/2014 1:07:42 PM - Verbose - (3036, 5676) - Initializing cache for user &lt;MachineName&gt;\&lt;UserName&gt;.
  9/3/2014 1:07:42 PM - Verbose - (3036, 5676) - Loading profile for user &lt;MachineName&gt;\&lt;UserName&gt;.
  9/3/2014 1:07:42 PM - Verbose - (3036, 5676) - Initializing cache for user &lt;MachineName&gt;\&lt;UserName&gt;.
  9/3/2014 1:07:42 PM - Verbose - (3036, 5676) - Loading profile for user &lt;MachineName&gt;\&lt;UserName&gt;.
  9/3/2014 1:07:42 PM - Error - (3036, 5676) - Object reference not set to an instance of an object.: \r\n\r\n   at Microsoft.TeamFoundation.Release.Data.Model.SystemSettings.LoadXml(Int32 id)
     at Microsoft.TeamFoundation.Release.Data.Model.ModelFactory.Load[T](Int32 id)
     at Microsoft.TeamFoundation.Release.DeploymentAgent.Services.Deployer.HeartBeat.SetNewInterval()
     at Microsoft.TeamFoundation.Release.DeploymentAgent.Services.Deployer.HeartBeat.TimerElapsed(Object sender, ElapsedEventArgs e)
  9/3/2014 1:08:04 PM - Information - (3036, 5840) - Deployer service is stopped.
  </code></pre>
  
  <p>The log file shows all communication checks fail. What is going wrong? </p>
  
  <h2>UPDATE</h2>
  
  <p>After removing the key f92439b4a629bc3a41a69e308c... from the MachineKeys folder the permission error disappears. However, my Deployment Agent can still not connect to the server. This is what the log file shows:</p>
  
  <pre><code>9/8/2014 8:37:40 AM - Information - (2712, 292) - Service is running under identity: &lt;machinename&gt;\&lt;username&gt;
  9/8/2014 8:37:40 AM - Information - (2712, 292) - Deployer service is starting.
  9/8/2014 8:37:40 AM - Verbose - (2712, 292) - HeartBeat: Sending HeartBeat
  9/8/2014 8:37:40 AM - Verbose - (2712, 292) - HeartBeat: Starting Configuration Tests.
  9/8/2014 8:37:40 AM - Verbose - (2712, 292) - Initializing cache for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:40 AM - Verbose - (2712, 292) - Loading profile for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:40 AM - Verbose - (2712, 292) - Initializing cache for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:40 AM - Verbose - (2712, 292) - Loading profile for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:40 AM - Verbose - (2712, 292) - Initializing cache for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:40 AM - Verbose - (2712, 292) - Loading profile for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:40 AM - Verbose - (2712, 292) - Initializing cache for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:40 AM - Verbose - (2712, 292) - Loading profile for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:40 AM - Verbose - (2712, 292) - Initializing cache for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:40 AM - Verbose - (2712, 292) - Loading profile for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:40 AM - Verbose - (2712, 292) - Initializing cache for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:40 AM - Verbose - (2712, 292) - Loading profile for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:40 AM - Information - (2712, 292) - HeartBeat: Communication Tests terminated. Results are: 
   Test 1 of 7 failed:
  Communication with the Deployment Controller Web Service was not successful. The error received is: Object reference not set to an instance of an object.
  Test 2 of 7 failed:
  Communication with the database through the Deployment Controller Web Service was not successful. The error received during the test is: Object reference not set to an instance of an object.
  Test 3 of 7 failed:
  The account running this Windows Service is not a valid user in the Release Management Server. Please add the user and try again. For cross-domain scenarios using Shadow Accounts, add the local Shadow Account user to the Release Management Server. The error received during the test is: Root element is missing.
  Test 5 of 7 failed:
  Root element is missing.
  Test 6 of 7 failed:
  Root element is missing.
  
  9/8/2014 8:37:40 AM - Information - (2712, 292) - HeartBeat: HeartBeat timer is started.
  9/8/2014 8:37:40 AM - Verbose - (2712, 292) - Initializing cache for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:40 AM - Verbose - (2712, 292) - Loading profile for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:40 AM - Verbose - (2712, 292) - Initializing cache for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:40 AM - Verbose - (2712, 292) - Loading profile for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:40 AM - Verbose - (2712, 292) - Initializing cache for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:40 AM - Verbose - (2712, 292) - Loading profile for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:40 AM - Information - (2712, 292) - Deployment: Deployment Event Fetcher timer is started.
  9/8/2014 8:37:40 AM - Information - (2712, 292) - Cleanup: Cleanup Service timer is started.
  9/8/2014 8:37:45 AM - Verbose - (2712, 292) - Initializing cache for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:45 AM - Verbose - (2712, 292) - Loading profile for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:45 AM - Verbose - (2712, 292) - Initializing cache for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:45 AM - Verbose - (2712, 292) - Loading profile for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:45 AM - Verbose - (2712, 292) - Initializing cache for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:45 AM - Verbose - (2712, 292) - Loading profile for user &lt;machinename&gt;\&lt;username&gt;.
  9/8/2014 8:37:45 AM - Error - (2712, 292) - Object reference not set to an instance of an object.: \r\n\r\n   at Microsoft.TeamFoundation.Release.Data.Model.SystemSettings.LoadXml(Int32 id)
     at Microsoft.TeamFoundation.Release.Data.Model.ModelFactory.Load[T](Int32 id)
     at Microsoft.TeamFoundation.Release.DeploymentAgent.Services.Deployer.HeartBeat.SetNewInterval()
     at Microsoft.TeamFoundation.Release.DeploymentAgent.Services.Deployer.HeartBeat.TimerElapsed(Object sender, ElapsedEventArgs e)
  </code></pre>
  
  <p>I have created shadow accounts and this setup is working when I install the agent on an Azure virtual machine and use the same credentials as I'm using in this scenario. I suppose the problem has something to do with the proxy configuration at the customers site.</p>