Hello all,
Have anyone been able to (without resorting to the wizard that is present in the Azure Marketplace) been able to install P11 using an Azure SQL Database (not an SQL Managed Instance) using the good old Configuration Tool?
I am always getting the error in attach, and even generating the SQL script doesn't work. When I try to execute the script against the Azure SQL Server "instance" with the Administrator user that I specified when creating the first database under the Azure SQL Server, it gives me a lot of errors:
"
Msg 134, Level 15, State 1, Line 28The variable name '@cmd' has already been declared. Variable names must be unique within a query batch or stored procedure.Msg 40508, Level 16, State 1, Line 62USE statement is not supported to switch between databases. Use a new connection to connect to a different database.Msg 15151, Level 16, State 1, Line 73Cannot alter the role 'db_owner', because it does not exist or you do not have permission.Msg 15007, Level 16, State 2, Line 80'hr' is not a valid login or you do not have permission.Msg 15151, Level 16, State 1, Line 85Cannot add the principal 'hr', because it does not exist or you do not have permission.Msg 15151, Level 16, State 1, Line 86Cannot add the principal 'hr', because it does not exist or you do not have permission.
I naturally was able to solve this using Azure SQL Server Managed Instances, but it seems an unnecessary cost if OutSystems was able to do it using the Wizard...
Just for those who need it, I was finally able to get a platform running using Azure SQL Databases. How?
1 - Create in Azure portal (or via template, scripting... You pick your poison) the 3 databases (Platform, Logs and Session - from now on, as an example: outsystems, outsystems_log and osState). Be careful to select the correct instance size and collation (CI_AI) as well as other required Azure resources that you might need (Security Groups, vNets, etc.)
2 - Use SSMS to connect to the "master" database of the Azure SQL Server that contains the created databases with your Administrator account and create the required "principals":
CREATE LOGIN OSADMINWITH PASSWORD = '<your_OSADMIN_password>'GOCREATE LOGIN OSRUNTIMEWITH PASSWORD = '<your_OSRUNTIME_password>GOCREATE LOGIN OSADMIN_LOGWITH PASSWORD = '<your_OSADMIN_LOG_password>'GOCREATE LOGIN OSRUNTIME_LOGWITH PASSWORD = '<your_OSRUNTIME_LOG_password>'GOCREATE LOGIN OSSTATEWITH PASSWORD = '<your_OSSTATE_password>'GO
3 - Use SSMS to connect to the "platform" database of the Azure SQL Server that contains the created databases with your Administrator account, create the database users and map them to the principals
CREATE USER OSADMINFOR LOGIN OSADMINWITH DEFAULT_SCHEMA = dboGO-- Add user to the database owner roleEXEC sp_addrolemember N'db_owner', N'OSADMIN'GOCREATE USER OSRUNTIMEFOR LOGIN OSRUNTIMEWITH DEFAULT_SCHEMA = dboGO-- Add user to the database owner roleEXEC sp_addrolemember N'db_datawriter', N'OSRUNTIME'GO-- Add user to the database owner roleEXEC sp_addrolemember N'db_datareader', N'OSRUNTIME'GO
4 - Use SSMS to connect to the "log" database of the Azure SQL Server that contains the created databases with your Administrator account, create the database users and map them to the principals
CREATE USER OSADMIN_LOGFOR LOGIN OSADMIN_LOGWITH DEFAULT_SCHEMA = dboGO-- Add user to the database owner roleEXEC sp_addrolemember N'db_owner', N'OSADMIN_LOG'GOCREATE USER OSRUNTIME_LOGFOR LOGIN OSRUNTIME_LOGWITH DEFAULT_SCHEMA = dboGO-- Add user to the database owner roleEXEC sp_addrolemember N'db_datawriter', N'OSRUNTIME_LOG'GO-- Add user to the database owner roleEXEC sp_addrolemember N'db_datareader', N'OSRUNTIME_LOG'GO
5 - Use SSMS to connect to the "session" database of the Azure SQL Server that contains the created databases with your Administrator account, create the database users and map them to the principals
CREATE USER OSSTATEFOR LOGIN OSSTATEWITH DEFAULT_SCHEMA = dboGO-- Add user to the database owner roleEXEC sp_addrolemember N'db_owner', N'OSSTATE'GO
6 - Finally, run the configuration tool.
7 - For each tab on the configuration tool, besides the normal configurations you are used to (server, user names and passwords, etc) in the "Advanced Settings", include the following parameter:
Platform tab: Initial Catalog=outsystemsLog tab: Initial Catalog=outsystems_logSession tab: Initial Catalog=osState
(The catalog names must match the database names you selected previously for your installation in point 1)
8 - On the Platform and Log tab, test the connections to see if everything is working properly and click "Create and Upgrade database" (grant permissions will not work properly)
9 - On the Session tab, unfortunately, the standard "Create Session Database" won't work no matter what you do. As such, go to File->Generate Session SQL Script and save the SQL file. Open it in SSMS with a connection to the "session" database (see point 5).
Edit the script and remove the section that refers to the creation of the OSSTATE user. I recommend you clear everyting until you find the following comment at around line 51 :
-- HubSessionStateRole
Execute the whole script after you clear every line before that comment.
10 - Finally!!! Go back to the configuration tool and click "Apply and exit". If you did everything right, the Deployment controller and Deployment service will restart, you will get no errors in the event viewer and Service Center will compile and deploy properly.
Hope this helps.
It took me some time to work this out, but at step 7 there is a mistake:
Session tab: Initial Catalog=osState
should be
Session tab: Initial Catalog=osSession
Hi,
only saw this now because of our talk earlier today :)
Couple of things that we found out during the Marketplace templates development (and really big ones):