azure-sdk-for-go: `sql.ServersClient` `List` function results do not match the CLI (`az sql server list`) results

Bug Report

  • import path of package in question - github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/v5.0/sql
  • SDK version - 65.0.0+incompatible
  • go version go1.18.2 darwin/arm64
  • What happened?
  1. When I use the CLI and call az sql server list, a list of SQL servers is returned.
  2. When using the SDK, an empty list is returned.
for page, err := client.SqlServer.List(context.Background(), ""); page.NotDone(); err = page.Next() {
	if err != nil {
		panic(err)
	}

	for _, server := range page.Values() {
		fmt.Printf("found server %s\n", *server.Name)
	}
}
  • What did you expect or want to happen? I expected the SDK to return the same servers found when using the CLI.

  • How can we reproduce it?

  1. Create an SQL server
  2. Call az sql server list to see the server in the list.
  3. Now try calling the List function from a go program.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

@navba-MSFT I’m still seeing the same error message after granting “SQL DB Contributor” permissions. I’ll open a support ticket with Microsoft. Thanks

@kany Thanks for the log. Nothing return from HTTP for subscription 85513e74-2aae-4f6d-bb54-0549a72dcacd. I’ll let service team to have a look.