Threat Detection Service blocking alter database ... modify filegroup ... command
While creating a new database on SQLMI using a SQL script generated from SSDT, this command failed:
ALTER DATABASE [$(DatabaseName)] MODIFY FILEGROUP [BIEN2013] READ_ONLY;
with this error message:
Msg 5070, Level 16, State 2, Line 29
Database state cannot be changed while other users are using the database 'd3b218ed-c416-49c2-bc26-02e915c7e3b6'
when I looked at the sp_who2 output, I saw that there was a spid from the "TdService" in that DB. Looking this up shows that this is the "Threat Detection Service".
The spid eventually went away, but this blocked my SSDT deploy.