Reference another package from a step template

I’m trying to find the optimal way to create a re-usabale step template for dacpac deployments to Azure. I’m aware the community template, however this requires a previous step to retrieve the NuGet package that the dacpac sits in, and then extract the files in a location that persists for the next dacpac deploy step to pick up on.

Now that script steps allow you to reference and retrieve packages, I was hoping to use that but it seems you can’t create a step template that allows the uses to dynamically select a package. It’s set in the step template itself and not configurable after that. Is there a way to allow this? If this could be done, it would mean that anyone could easily select the deploy dacpac step, select the package that’s right for them, alter a few parameters and off they go.

So what I’m currently doing is using the “Deploy Package” step, but this doesn’t allow worker pools and will require the deploy scripts to be included in the package at build time. However, I’d prefer to have that single, re-usable template, with worker pools, that doesn’t need to reference other steps.

Does anyone know if that’s possible? Many thanks.

Hi Daniel,

This is a great question!

It is possible to do this. You can bind a package ID to a variable in a step and also in a step template. In your step template, you can create a parameter to represent the package ID and bind the ID of your reference package to that parameter. Consumers of your template will provide their package ID to the step. You can also bind the feed ID if you have multiple feeds.

We recorded a short video on how to do this that walks through the whole process. I hope you find it helpful.

Let me know if you have other questions on how to configure this.

Best,
Ryan

Thanks for such a prompt reply Ryan. I’ll give this a go.

Great video btw :slight_smile:

Thanks! I’m happy to be able to share it to answer questions :smiley:

Though it’d be nice to provide a drop down option like you would when using the built in step templates directly, so far this is working out quite well. Many thanks. I’m having a go at writing a second version of the DACPAC deployment community template. If that works out, I’ll find where I can do a pull request for it. Cheers Ryan.

1 Like

Sounds good, Daniel. Glad it’s working for you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.