Deploy an Azure EventHub for a web service

We are deploying a web application to Azure which has an EventHub. We are deploying this into a resource group and have the account and resource group available. Is there a simple way to create the namespace/event hub/consumer group?

My google-foo hasn’t found any examples.

Hi Greg,

Thanks for getting in touch.

If you’re deploying with say, an “Azure Web App” step, you could potentially configure custom scripts to run after your web-app package has been extracted. For example, in your step, select the “Configure features” link, apply “Custom deployment scripts”, then add whatever PowerShell you wish as a “Post-deployment script”.

You could also potentially do this via a separate deployment step after your app has been deployed, using a “Run an Azure PowerShell Script” step (see this guide for details.

Microsoft has some documentation here for managing Service Bus resources via PowerShell, so you could try working with the Azure PowerShell cmdlets regarding event hub namespaces etc, depending on what you’re trying to accomplish.

We’d recommend first figuring out how to do what you need using PowerShell scripting, then that can easily be integrated into your Octopus deployment pipeline.

Hope this helps.


Mark, Thanks for the follow-up. I am simply following the Octopus Deploy documention for deploying a resource group. I had failed to explore using that option because I already had a ‘resource group’. I think the language/naming of this step is a little off centre.

Hi Greg,

Ah I see. Sorry, I read deploying a web application and assumed you were using the “Deploy an Azure Web App” step.

If the current step type you’re using is working for you and you just need some additional scripting to create the namespace (after your ARM template has run), then the Azure PowerShell step can help there.

If however, you are just deploying a web application package to an existing Azure web-app (that you already have configured in the Azure portal against your resource group), you could consider the Getting started with Azure Web Apps guide, as this gives you a lot of power to incorporate additional scripting if you need.

Let me know how you go.