[BUG] Cannot get SQL databases
See original GitHub issueLibrary name and version
Azure.ResourceManager.Sql 1.0.0-beta.4
Describe the bug
Following code:
await foreach (SqlDatabaseResource resource in sqlServer.GetSqlDatabases().GetAllAsync())
{
Console.WriteLine("SQL db: " + resource);
}
results with a InvalidOperationException:
The requested operation requires an element of type 'Number', but the target element has type 'String'.
Expected behavior
Databases are listed
Actual behavior
Exception is thrown
Reproduction Steps
Just run this code:
try
{
var subscription = subscriptions.Get(subscriptionId).Value;
await foreach (var resource in subscription.GetResourceGroups().GetAllAsync())
{
Console.WriteLine("RG: " + resource.Data.Name);
}
var resourceGroup = subscription.GetResourceGroup(rgName).Value;
await foreach (var resource in resourceGroup.GetSqlServers().GetAllAsync())
{
Console.WriteLine("SQL server: " + resource.Data.Name);
}
var sqlServer = resourceGroup.GetSqlServer(serverName).Value;
await foreach (var resource in sqlServer.GetElasticPools().GetAllAsync())
{
Console.WriteLine("SQL ep: " + resource.Data.Name);
}
await foreach (SqlDatabaseResource resource in sqlServer.GetSqlDatabases().GetAllAsync())
{
Console.WriteLine("SQL db: " + resource);
}
}
catch (InvalidOperationException e)
{
Console.WriteLine(e.Message);
}
Environment
No response
Issue Analytics
- State:
- Created a year ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
Troubleshoot connectivity issues in SQL Server
Provides an overview of common connectivity issues in SQL Server and describes the tools to troubleshoot the issues.
Read more >SQL Server Login can't see databases
It sounds like you have removed the View Any Database permission from the Public role. If the Public role doesn't have the View...
Read more >HOW TO FIX CANNOT CONNECT TO SQL SERVER ERROR
Verify that the instance name is correct and that SQL Server is ... click: https://docs.microsoft.com/ sql /relational- databases /errors-events ...
Read more >Resolving could not open a connection to SQL Server errors
Go to the Connections tab and make sure Allow remote connections to this server is checked. If you need to make a change,...
Read more >Error: 'Failed to connect to database' when attempting to ...
Answer. PROBLEM. When attempting to connect to a backend MS SQL Server database you receive an error similar to 'Failed to connect to ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
1.0.0-beta.5 works now.
Please try with Azure.ResourceManager.Sql 1.0.0-beta.5.