Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to add UserAssignedIdentity on database as external user and grant db permission on mssql managed database #60

Open
jvenkat255 opened this issue Apr 19, 2023 · 1 comment

Comments

@jvenkat255
Copy link

jvenkat255 commented Apr 19, 2023

Unable to add UserAssignedIdentity on database as external user and grant db permission on mssql managed database

resource "mssql_user" "adduser" {
  server {
    host = hostname
    login {
      username = "xxxx"
      password = xxxxxx
    }
  }
  database  = "database"
  username  = dbuser
  object_id = dbpass
  roles               = ["db_datawriter", "db_datareader"]
}

UserAssigned Managed Identity has been added on MS SQL however we're unable to create and grant db access on data bases thru terraform

Error: │ Error: unable to create user [database].[hostname]: mssql: Incorrect syntax near 'type'.

We have been blocked from past 1 month, really appreciate any help on the issue.

When I ran SQL cmds on SSMS it worked but we would like to implement thru Terraform

CREATE USER [<managed-identity-name>] FROM EXTERNAL PROVIDER;
ALTER ROLE db_datareader ADD MEMBER [<managed-identity-name>];
ALTER ROLE db_datawriter ADD MEMBER [<managed-identity-name>];
ALTER ROLE db_ddladmin ADD MEMBER [<managed-identity-name>];
GO
@jvenkat255 jvenkat255 changed the title Unable to create user accounts and grant db permission on mssql managed database Unable to add UserAssignedIdentity on database as external user and grant db permission on mssql managed database Jul 15, 2023
@jvenkat255
Copy link
Author

jvenkat255 commented Jul 15, 2023

@magne @alxy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant