Developer Machine Setup (Azure Service Bus Transport)

We are starting the process of adopting NServiceBus into our solution and plan to use the Azure Service Bus transport. My plan is to have a Azure Service Bus namespace created for each developer; however, I haven’t come up with a good method for managing the settings as the project grows and more queues/endpoints are added. The two goals that I have are first, developers have an isolated environment and second, reduce the management of settings.

If anyone has suggestions or would like to elaborate on their experience implementing the Azure Service Bus transport in their organization I would be very interested to learn more. Thanks in advance.

Hi Craig,

I’m not entirely sure if the question is geared towards Service Bus connection string or any setting in general. I’ll provide both.

For a single configuration that needs to be different per team member, I found environment variables to be very helpful. It’s secure, specific to the machine it’s running on, and nothing is checked into the repository. With the .NET Core configuration API (Providers) that becomes even easier as settings can be read from files, environment variables, or command-line arguments.

Which brings the second answer, if you need to manage all the settings per user. You could still do environment variables, but that could be a lot. Another option is to have a setting.json file as a template for all the keys that .NET Core Configuration API can handle, as well as local versions (per developer/environment) that are not checked in. In higher environments setting.json could be configured with the values relevant to the environment in use.

And then there’s another option. Since you’re already consuming Azure resources, have you had a chance to look at Azure Application Configuration service? The nice thing about it is that it allows multiple environments for the same keys. Which means you could have each developer have its own prefix with the values unique to them, including production. An environment variable such as environment could indicate what prefix to use, Jane, John, qa, or production.

Hope that helps.

Sean, thank you for your response. I read through the documentation that you linked to and found some great answers. Also, I wanted to clarify that you are correct, I was trying to solve the issue with developers including Azure Service Bus connection strings into settings files along with other developer specific configuration values to Azure assets.

The solution that I ended up going with is User Secrets. I added the UserSecretsId tag + Guid in each project containing user secrets. Then wrote a powershell script that when run prompts the user for each variable to be stored as a user secret. Once done their machine is configured and ready to go.

I also had to add user secrets to the IConfigurationBuilder on startup of each project using User Secrets.

if (hostContext.HostingEnvironment.IsDevelopment())

Sean , thanks again for your assistance.