Skip to content

Commit

Permalink
List all SQL servers in a subscription (Azure#4424)
Browse files Browse the repository at this point in the history
* List sql servers by subscription or by group.

In other words, -g is now optional for az sql server list.

* Added changelog for list servers by subscription
  • Loading branch information
jaredmoo authored and troydai committed Sep 12, 2017
1 parent 304f24a commit 93234fb
Show file tree
Hide file tree
Showing 6 changed files with 325 additions and 144 deletions.
5 changes: 5 additions & 0 deletions src/command_modules/azure-cli-sql/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
Release History
===============

Unreleased
++++++++++++++++++++
* az sql server list --resource-group argument is now optional. If not specified, all sql servers in the entire subscription will be returned.

2.0.11 (2017-09-11)
+++++++++++++++++++
* Added az sql server vnet-rule commands.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@
helps['sql server list'] = """
type: command
short-summary: Lists servers.
examples:
- name: List all servers in the current subscription
text: az sql server list
- name: List all servers in a resource group
text: az sql server list -g mygroup
"""
helps['sql server update'] = """
type: command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
c.command('create', 'create_or_update')
c.command('delete', 'delete', confirmation=True)
c.command('show', 'get')
c.command('list', 'list_by_resource_group')
c.custom_command('list', 'server_list')
c.generic_update_command('update', 'get', 'create_or_update',
custom_func_name='server_update')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,19 @@ def elastic_pool_list_capabilities(
###############################################


# Lists servers in a resource group or subscription
def server_list(
client,
resource_group_name=None):

if resource_group_name:
# List all servers in the resource group
return client.list_by_resource_group(resource_group_name=resource_group_name)

# List all servers in the subscription
return client.list()


# Update server. Custom update function to apply parameters to instance.
def server_update(
instance,
Expand Down
Loading

0 comments on commit 93234fb

Please sign in to comment.