When installing large numbers of agents, or using virtual machines with a temporary lifespan, it can be helpful to be able to automate the creation of Deployment Manager agents. Here is one way to do so:
Install an agent manually to serve as a template
First of all, install an agent using the normal manual install process. This will ensure that you know which firewall settings you need to tweak on the target machines, and generate an X509 encryption key which can then be shared among the agents you want to automate.
Note: using this method will allow the agents to impersonate each other if one is compromised. Think carefully before using this technique to share security settings between agents with different levels of security
Run the installer silently on the target machine
Using Microsoft's Group Policy, or your organisation's preferred equivalent, execute the agent installer silently on the target machine. If using a script to execute the installer, remember to set the /quiet flag for a silent install.
Update the registry keys on the new agent to the same values as the template machine
Inside "HKEY_LOCAL_MACHINE\SOFTWARE\Red Gate\Deployment Manager\", set the registry keys "Agent.Security.TrustedDmThumbprints" and "Cert-cn=Red Gate Deployment Agent" to be the values of the equivalent keys on your template machine. This will instruct the agent to use the same x509 encryption certificate to encrypt its messages and identify itself to the server. It will also instruct it to accept incoming instructions from the same server.
If you choose to roll out these registry changes using Microsoft's Group Policy, you may find the following template for a custom policy useful:
This article about setting up a custom policy in Group Policy may be of help: see part 2: "the hard way" for advice on using the above template.
Register the new agent with the server
All that remains now is to tell the server where it can find the new machine. You can do this by making a POST request to the following url:
http://<Deployment Manager server address and port>/api/environments/<EnvironmentId>/machines/add
The following properties should be set:
The user-facing name for the agent in the Deployment Manager system
The host name the server should use to communicate with the agent
Unless you have configured your agents to be different, this should be "10301"
This should be the value of the thumprint you used to set up your initial template machine
The ID of the environment you wish to add the machine to. View the metadata for your environments by navigating in the browser to
http://<Deployment Manager server address and port>/api/environments
The POST data for your request should look something like: