Error when deploying using SQL-DACPAC step template

SQL-DACPAC is community step template
when we run the to deploy DACPAC very often getting below error ,


The step template run till the $decservice.Deploy() in the above image ,
after that we getting error in Unregister-Event cmdlet
| The step failed: Activity Deploy {stepname }on Workers-Pool-LE failed with error ‘The remote script failed with exit code 1’

So kindly help on this

Hi @yuvarajit07 and welcome to the Octopus Community.

Firstly, would you please expand on this:
when we run the to deploy DACPAC very often getting below error

Does this mean that sometimes the command is working?
If so, we might want to look at what failing and succeeding “Unregister-Event” commands have in common.

What version of Powershell are you using?

Would you be able to change those last two “Unregister-Event” lines to the following:

 Get-Event -SourceIdentifier "ProgressChanged" -ErrorAction Ignore
 Unregister-Event -SourceIdentifier "ProgressChanged"
 Get-Event -SourceIdentifier "Message" -ErrorAction Ignore
 Unregister-Event -SourceIdentifier "Message"

This will hopefully give us some more information to work off.



Hi Dane,
We are using octopus community template , if we do any changes in that , we need to save as copy of that right ?
In this case, we don’t get any new updates for the step template right ?
kindly suggest

Hi @yuvarajit07,

Thank you for getting back to us.

For testing, yes, you would need to save a copy of the Step Template currently linked to the Community Step Template to make changes. However, the SQL - Deploy DACPAC Step Templates are maintained by a member of our Solutions Team. I’ve sent a message for them to have a look at this for us as well.

Either he or I will get back to you once he’s had a chance to review this post.

Best Regards,

Greetings! Would you be able to provide a full log file for review? I’m thinking the register event may not be working so the unregister-event may be failing because of it.



Could you please provide me the any workspace or upload link , so that I can share my logs

Hi @yuvarajit07 ,

You should be able to upload the files using the following link.


I have uploaded the log file “SQL_DACPAC_issue_log.txt”.
Kindly check.

Thank you for providing the log file, it was useful in determining if the event registration was working correctly. The messages in the log like DacServices: Extracting schema from database are indeed from the event as the code block prefixes the messages with DacServices: so that’s not failing. There are multiple versions of the DACPAC template, would you be able to tell us which one you’re using?

During my analysis, I found the original version of the template had the Unregister-Event call in a Finally block, the others look to have moved it out of the Finally and into the Try portion. I’m not sure as to why this change was made and I’m hesitant to add it back as this is used by quite a few people. Would you be willing to test moving it back into the Finally (or add the Finally block back, actually) and see if that fixes your issue? I tried it locally and it seemed to work fine, but before implementing it, I’d like to see if it actually resolves your issue.



we are using Version 11

Hi Shawn,

if we do any changes in that , we need to save as copy of the community template
In this case, we need to do changes in many places and we don’t get any new updates for the step template right ?
kindly suggest,
Which version having the finally block code ? , is it possible can we use it ?

Version 16 (the latest available) was the one I was looking at which had it in the finally block. You could upgrade the template to that and then test it out on one of your projects to see if that fixes it. I’m not terribly confident that it will, unfortunately.



Ok Thanks Shawan , let me update and monitor the deployments .

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