When the default_schema is not set, we have found that identities (such as managed identities that are members of Azure Entra ID groups) run into issues when running trying to run database migrations that involve setting up schemas, tables, etc.
Typically an error is thrown similar to the following:
Error occurred during DB Migration: "The specified schema name \"<Object ID>@<Directory/Tenant ID>\" either does not exist or you do not have permission to use it."
This gets fixed by running:
ALTER USER [<Azure Entra ID Group Name>] WITH DEFAULT_SCHEMA=[dbo]
Which might be accounted for by specifying the default_schema in the CreateUser function.
I believe this could be updated here: https://github.com/betr-io/terraform-provider-mssql/blob/master/sql/user.go#L113
When the
default_schema
is not set, we have found that identities (such as managed identities that are members of Azure Entra ID groups) run into issues when running trying to run database migrations that involve setting up schemas, tables, etc.Typically an error is thrown similar to the following:
This gets fixed by running:
Which might be accounted for by specifying the default_schema in the CreateUser function.