Open Charles-Gagnon opened 1 year ago
Adding to that, a reproducible usecase that fails: Expanding AzureSQLServer/Security/Logins
23-05-12 15:57:49.1957642 pid:50148 tid:29 sqltools Verbose: 0 : eventTID:21980 SqlError.ctor | ERR | Info Number 229, Error State 5, Error Class 14, Error Message 'The SELECT permission was denied on the object 'sql_logins', database 'master', schema 'sys'.', Procedure '', Line Number 2
23-05-12 15:57:49.1959344 pid:50148 tid:29 sqltools Verbose: 0 : eventTID:21980 TdsParserStateObject.DecrementOpenResultCount | INFO | State Object Id 191, Processing Attention.
23-05-12 15:57:49.2000276 pid:50148 tid:29 sqltools Error: 0 : Failed getting smo objects. parent:sqlclient.database.windows.net/Security/Logins querier: Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel.SqlLoginQuerier error:An exception occurred while executing a Transact-SQL statement or batch. inner:The SELECT permission was denied on the object 'sql_logins', database 'master', schema 'sys'. stacktrace: at Microsoft.SqlServer.Management.Common.ServerConnection.GetExecuteReader(SqlCommand command)
at Microsoft.SqlServer.Management.Smo.ExecuteSql.GetDataReader(String query, SqlCommand& command)
at Microsoft.SqlServer.Management.Smo.DataProvider.SetConnectionAndQuery(ExecuteSql execSql, String query)
at Microsoft.SqlServer.Management.Smo.ExecuteSql.GetDataProvider(StringCollection query, Object con, StatementBuilder sb, RetriveMode rm)
at Microsoft.SqlServer.Management.Smo.SqlObjectBase.FillDataWithUseFailure(SqlEnumResult sqlresult, ResultType resultType)
at Microsoft.SqlServer.Management.Smo.SqlObjectBase.BuildResult(EnumResult result)
at Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetData()
at Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetData(Request req, Object ci)
at Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.GetData(Object connectionInfo, Request request)
at Microsoft.SqlServer.Management.Smo.ExecutionManager.GetEnumeratorDataReader(Request req)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.InitChildLevel(Urn levelFilter, ScriptingPreferences sp, Boolean forScripting, IEnumerable`1 extraFields)
at Microsoft.SqlServer.Management.Smo.SmoCollectionBase.InitializeChildCollection(Boolean refresh, ScriptingPreferences sp, String filterQuery, IEnumerable`1 extraFields)
at Microsoft.SqlServer.Management.Smo.SmoCollectionBase.ClearAndInitialize(String filterQuery, IEnumerable`1 extraFields)
at Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel.SqlLoginQuerier.Query(SmoQueryContext context, String filter, Boolean refresh, IEnumerable`1 extraProperties) in /_/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.cs:line 96
at Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel.SmoChildFactoryBase.OnExpandPopulateNonFolders(IList`1 allChildren, TreeNode parent, Boolean refresh, String name, CancellationToken cancellationToken, IEnumerable`1 appliedFilters) in /_/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoChildFactoryBase.cs:line 189
23-05-12 15:57:49.2001832 pid:50148 tid:29 sqltools Error: 0 : Failed expanding oe children. parent:sqlclient.database.windows.net/Security/Logins error:An exception occurred while executing a Transact-SQL statement or batch. inner:The SELECT permission was denied on the object 'sql_logins', database 'master', schema 'sys'. stacktrace: at Microsoft.SqlServer.Management.Common.ServerConnection.GetExecuteReader(SqlCommand command)
at Microsoft.SqlServer.Management.Smo.ExecuteSql.GetDataReader(String query, SqlCommand& command)
at Microsoft.SqlServer.Management.Smo.DataProvider.SetConnectionAndQuery(ExecuteSql execSql, String query)
at Microsoft.SqlServer.Management.Smo.ExecuteSql.GetDataProvider(StringCollection query, Object con, StatementBuilder sb, RetriveMode rm)
at Microsoft.SqlServer.Management.Smo.SqlObjectBase.FillDataWithUseFailure(SqlEnumResult sqlresult, ResultType resultType)
at Microsoft.SqlServer.Management.Smo.SqlObjectBase.BuildResult(EnumResult result)
at Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetData()
at Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetData(Request req, Object ci)
at Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.GetData(Object connectionInfo, Request request)
at Microsoft.SqlServer.Management.Smo.ExecutionManager.GetEnumeratorDataReader(Request req)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.InitChildLevel(Urn levelFilter, ScriptingPreferences sp, Boolean forScripting, IEnumerable`1 extraFields)
at Microsoft.SqlServer.Management.Smo.SmoCollectionBase.InitializeChildCollection(Boolean refresh, ScriptingPreferences sp, String filterQuery, IEnumerable`1 extraFields)
at Microsoft.SqlServer.Management.Smo.SmoCollectionBase.ClearAndInitialize(String filterQuery, IEnumerable`1 extraFields)
at Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel.SqlLoginQuerier.Query(SmoQueryContext context, String filter, Boolean refresh, IEnumerable`1 extraProperties) in /_/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.cs:line 96
at Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel.SmoChildFactoryBase.OnExpandPopulateNonFolders(IList`1 allChildren, TreeNode parent, Boolean refresh, String name, CancellationToken cancellationToken, IEnumerable`1 appliedFilters) in /_/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoChildFactoryBase.cs:line 189
at Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel.SmoChildFactoryBase.Expand(TreeNode parent, Boolean refresh, String name, Boolean includeSystemObjects, CancellationToken cancellationToken, IEnumerable`1 filters) in /_/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoChildFactoryBase.cs:line 56
23-05-12 15:57:49.2002649 pid:50148 tid:29 sqltools Error: 0 : Failed populating oe children. error:An exception occurred while executing a Transact-SQL statement or batch. inner:The SELECT permission was denied on the object 'sql_logins', database 'master', schema 'sys'. stacktrace: at Microsoft.SqlServer.Management.Common.ServerConnection.GetExecuteReader(SqlCommand command)
at Microsoft.SqlServer.Management.Smo.ExecuteSql.GetDataReader(String query, SqlCommand& command)
at Microsoft.SqlServer.Management.Smo.DataProvider.SetConnectionAndQuery(ExecuteSql execSql, String query)
at Microsoft.SqlServer.Management.Smo.ExecuteSql.GetDataProvider(StringCollection query, Object con, StatementBuilder sb, RetriveMode rm)
at Microsoft.SqlServer.Management.Smo.SqlObjectBase.FillDataWithUseFailure(SqlEnumResult sqlresult, ResultType resultType)
at Microsoft.SqlServer.Management.Smo.SqlObjectBase.BuildResult(EnumResult result)
at Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetData()
at Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetData(Request req, Object ci)
at Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.GetData(Object connectionInfo, Request request)
at Microsoft.SqlServer.Management.Smo.ExecutionManager.GetEnumeratorDataReader(Request req)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.InitChildLevel(Urn levelFilter, ScriptingPreferences sp, Boolean forScripting, IEnumerable`1 extraFields)
at Microsoft.SqlServer.Management.Smo.SmoCollectionBase.InitializeChildCollection(Boolean refresh, ScriptingPreferences sp, String filterQuery, IEnumerable`1 extraFields)
at Microsoft.SqlServer.Management.Smo.SmoCollectionBase.ClearAndInitialize(String filterQuery, IEnumerable`1 extraFields)
at Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel.SqlLoginQuerier.Query(SmoQueryContext context, String filter, Boolean refresh, IEnumerable`1 extraProperties) in /_/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.cs:line 96
at Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel.SmoChildFactoryBase.OnExpandPopulateNonFolders(IList`1 allChildren, TreeNode parent, Boolean refresh, String name, CancellationToken cancellationToken, IEnumerable`1 appliedFilters) in /_/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoChildFactoryBase.cs:line 189
at Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel.SmoChildFactoryBase.Expand(TreeNode parent, Boolean refresh, String name, Boolean includeSystemObjects, CancellationToken cancellationToken, IEnumerable`1 filters) in /_/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoChildFactoryBase.cs:line 56
at Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes.TreeNode.PopulateChildren(Boolean refresh, String name, CancellationToken cancellationToken, String accessToken, IEnumerable`1 filters) in /_/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/Nodes/TreeNode.cs:line 391
23-05-12 15:57:49.2004981 pid:50148 tid:25 sqltools Verbose: 0 : Done with binding operation for sqlclient.database.windows.net/Security/Logins
23-05-12 15:57:49.2006834 pid:50148 tid:12 sqltools Verbose: 0 : Sending message of id[], of type[Event] and method[objectexplorer/expandCompleted]
Adding a note that this still occurs in ADS 1.46 Insider and I would suspect it's extremely confusing for users. I guessed at what was happening because I tried other Azure SQL DB servers...and then tried running the T-SQL to create the AAD login, which then gave the appropriate error that I didn't have permissions.
Stable/RC1
An exception occurred while executing a Transact-SQL statement or batch
This is a general issue for all OE node expansion errors. The issue here is that the user has no idea what went wrong - and only if they dig into the STS logs can they see what the actual problem is. We should allow them to see more detailed information - in the case of a SqlException the specific error message returned by the engine.