Restrict access to azure managed instance db before running migration
Before moving to an Azure Managed Instance db (compatibility set to SQL 2014), we were able to run this command to kick out other users and end their transactions:
ALTER DATABASE [$(DatabaseName)] SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE;
But after migrating to an azure managed instance that command results in an error:
"This ALTER DATABASE statement is not supported. Correct the syntax and execute the statement again."
How can we end open sessions transactions to allow the migrations to proceed safely?