Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Provisioning / Deprovisioning JSONs for SQL Server

yogesh
Regular Contributor III
Regular Contributor III

The docs don't explain how I can provision / deprovision accounts if multiple statements are required to be executed for example, in case of SQL Server we have to execute below statements to create a login and a user in order to create an account in the target:


USE [master]
GO
CREATE LOGIN [MYDOMAIN\myusername] FROM WINDOWS WITH DEFAULT_DATABASE=[master]
GO
USE [mydbname]
GO
CREATE USER [MYDOMAIN\myusername] FOR LOGIN [MYDOMAIN\myusername]
GO

similarly multiple statements are required for account removal as well.
These statements are pretty standard for SQL Server.

How do I form the CREATEACCOUNTJSON and DELETEACCOUNTJSON for SQL server

2 REPLIES 2

yogesh
Regular Contributor III
Regular Contributor III

GRANTACCESSJSON and REVOKEACCESSJSON are working for me but I can not get the CREATEACCOUNTJSON and DELETEACCOUNTJSON working:

Have tried these JSONs:
CREATEACCOUNTJSON:

{
	"CreateAccountQry": [
		"CREATE LOGIN [${accountName}] FROM WINDOWS WITH DEFAULT_DATABASE=[master]",
		"CREATE USER [${accountName}] FOR LOGIN [${accountName}]"
	]
}


{
	"CreateAccountQry": [
		"USE [master]",
		"GO",
		"CREATE LOGIN [${accountName}] FROM WINDOWS WITH DEFAULT_DATABASE=[master]",
		"GO",
		"USE [RAEUDXT05]",
		"GO",
		"CREATE USER [${accountName}] FOR LOGIN [${accountName}]",
		"GO"
	]
}

 

DELETEACCOUNTJSON 

{
	"DeleteAccountQry": [
		"DROP USER [${accountName}]",
		"DROP LOGIN [${accountName}]"
	]
}


{
	"DeleteAccountQry": [
		"USE [RAEUDXT05]",
		"GO",
		"DROP USER [${accountName}]",
		"GO",
		"USE [master]",
		"GO",
		"DROP LOGIN [${accountName}]",
		"GO"
	]
}

 

Working queries for add and remove access:

{
	"Role": [
		"ALTER ROLE [${task.entitlement_valueKey.entitlement_value}] ADD MEMBER [${accountName}]"
	]
}
{
	"Role": [
		"ALTER ROLE [${task.entitlement_valueKey.entitlement_value}] DROP MEMBER [${accountName}]"
	]
}

I get this error on the create account task and remove account tasks:
SAV - Error while creating account - mydom\myaccountname -Exception occured while Excecuting Query

gwagh
Regular Contributor
Regular Contributor

Hi @yogesh, Did you get any solution ? We are facing same error in createaccountjson.