If the ServiceBroker is not enabled or the database is not trustworthy, the permissions stated in code are not sufficient.
The SQL_FORMAT_INSTALL_SEVICE_BROKER_NOTIFICATION does not run successfully, because it trys to fisx these database settings.
For this to execute the ALTER DATABASE permission is needed.
I suggest to remove the part that automatically trys to fix the database settings instead of instructing to grant ALTER DATABASE permission. It is not needed during normal execution.
Is there a reason other than convenience to have the settings adjusted automatically?
If the ServiceBroker is not enabled or the database is not trustworthy, the permissions stated in code are not sufficient.
The SQL_FORMAT_INSTALL_SEVICE_BROKER_NOTIFICATION does not run successfully, because it trys to fisx these database settings. For this to execute the ALTER DATABASE permission is needed.
I suggest to remove the part that automatically trys to fix the database settings instead of instructing to grant ALTER DATABASE permission. It is not needed during normal execution.
Is there a reason other than convenience to have the settings adjusted automatically?