What are the challenges you face when working across database platforms? Take the survey

Invoke-DatabaseBuild - Post build: ALTER DATABASE SET SINGLE_USER statement failing on Azure SQL MI

wstypwstyp Posts: 2 New member
edited December 15, 2022 4:47PM in SQL Change Automation

We are migrating to Azure SQL Managed Instance for all of our databases. We have found that the Invoke-DatabaseBuild is failing after the schema validation build step is done. It appears Invoke-DatabaseBuild attempts to set the database to single user mode before attempting to drop it. This is an invalid ALTER DATABASE command for Azure SQL Managed Instance. I could not immediately find a flag to skip setting single user mode.

We used sql profiler to identity the sql statements below.
ALTER DATABASE [sql_change_automation_f3a96260-d563-4bff-9153-c05f744974b7] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
DROP DATABASE [sql_change_automation_f3a96260-d563-4bff-9153-c05f744974b7];



Sign In or Register to comment.