Open Krad-dono opened 1 year ago
Another issue I discovered relates to how database creation resource works. My use case:
ALTER DATABASE [${each.key}] SET DISABLE_BROKER WITH ROLLBACK IMMEDIATE;
The operation cannot be performed on database "new_db" because it is involved in a database mirroring session or an availability group. Some operations are not allowed on a database that is participating in a database mirroring session or in an availability group.
Maybe it is possible to add few parameters to "mssql_database" resource like from preferred db creation script below?
DECLARE @query varchar(max)
DECLARE @database varchar(500)
DECLARE @script VarChar(MAX)
SET @database='database_name' -- <<< Change database name
set @query='
CREATE DATABASE ['+@database+']
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'+@database+', FILENAME = N''D:\rdsdbdata\DATA\'+@database+'.mdf'' , SIZE = 65536KB , FILEGROWTH = 1048576KB )
LOG ON
( NAME = N'+@database+'_log, FILENAME = N''D:\rdsdbdata\DATA\'+@database+'_log.ldf'' , SIZE = 65536KB , FILEGROWTH = 524288KB )
GO
ALTER DATABASE ['+@database+'] SET CONTAINMENT = PARTIAL WITH NO_WAIT
GO
ALTER DATABASE ['+@database+'] SET AUTO_CLOSE OFF
GO
ALTER DATABASE ['+@database+'] SET DISABLE_BROKER
GO
ALTER DATABASE ['+@database+'] SET RECOVERY FULL
GO
'
SET @script = 'EXEC (''' + REPLACE(REPLACE(@query, '''', ''''''), 'GO', '''); EXEC(''') + ''');'--Just add this one line.
exec(@script)
Hello,
I'm having some missing feature in current provider version when wanting to setup SQL users that use contained auth. Current "mssql_sql_user" resource can't do that and creating with script resource limits what you can do with that user. So maybe you can please add additional parameters to "mssql_sql_user" resource for contained auth? Like password.
CREATE USER [<user_name>] WITH PASSWORD=N'<password>'
As well if we're talking about contained auth, maybe parameter in "mssql_database" to run alter database would be nice too like:
ALTER DATABASE [<database name>] SET CONTAINMENT = PARTIAL WITH NO_WAIT
or any other ALTER DATABASE.