Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/azure-cli/azure/cli/command_modules/sql/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,3 +421,27 @@ def _outbound_firewall_rule_table_format(result):
])

return _apply_format(result, _outbound_firewall_rule_table_format)

########################################################
# sql server soft-delete retention days #
########################################################


def retention_days_table_format(result):
'''
Formats a single or list of server soft delete retention settings as summary results for display with "-o table".
'''

def _retention_days_table_format(result):
'''
Formats a single or list of server soft delete retention settings as summary results for display with "-o table".
'''
from collections import OrderedDict

return OrderedDict([
('resourceGroupName', result['resourceGroupName']),
('serverName', result['serverName']),
('retentionDays', result['retentionDays'])
])

return _apply_format(result, _retention_days_table_format)
2 changes: 2 additions & 0 deletions src/azure-cli/azure/cli/command_modules/sql/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,8 @@
text: az sql server create -l westus -g mygroup -n myserver -u myadminuser -p myadminpassword
- name: Create a server with disabled public network access to server.
text: az sql server create -l westus -g mygroup -n myserver -u myadminuser -p myadminpassword -e false
- name: Create a server with soft delete retention (7 days) setting.
text: az sql server create -l westus -g mygroup -n myserver -u myadminuser -p myadminpassword --retention-days-soft-delete 7
- name: Create a server without SQL Admin, with AD admin and AD Only enabled.
text: az sql server create --enable-ad-only-auth --external-admin-principal-type User --external-admin-name myUserName --external-admin-sid c5e964e2-6bb2-1111-1111-3b16ec0e1234 -g myResourceGroup -n myServer
- name: Create a server without SQL Admin, with AD admin, AD Only enabled, User ManagedIdenties and Identity Type is SystemAssigned,UserAssigned.
Expand Down
45 changes: 45 additions & 0 deletions src/azure-cli/azure/cli/command_modules/sql/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -1894,6 +1894,12 @@ def _configure_security_policy_storage_params(arg_ctx):
options_list=['--federated-client-id', '--fid'],
help='The federated client id used in cross tenant CMK scenario.')

c.argument('retention_days',
options_list=['--retention-days-soft-delete'],
help='The number of days (from 0 to 35 inclusive) that your server will be'
'recoverable after initial deletion.',
is_preview=True)

with self.argument_context('sql server create') as c:
c.argument('location',
arg_type=get_location_type_with_default_from_resource_group(self.cli_ctx))
Expand Down Expand Up @@ -1935,10 +1941,49 @@ def _configure_security_policy_storage_params(arg_ctx):
options_list=['--external-admin-principal-type'],
help='User, Group or Application')

c.argument('retention_days',
options_list=['--retention-days'],
required=False,
help='The number of days (from 0 to 35 inclusive) that your server will be'
'recoverable after initial deletion.')
c.argument('create_mode',
options_list=['--create-mode', '--cm'],
required=False,
help='Normal or Restore')

with self.argument_context('sql server update') as c:
c.argument('administrator_login_password',
help='The administrator login password.')

c.argument('retention_days',
options_list=['--retention-days'],
required=False,
help='The number of days (from 0 to 35 inclusive) that your server will be'
'recoverable after initial deletion.')

with self.argument_context('sql server show') as c:
c.argument('expand_ad_admin',
options_list=['--expand-ad-admin'],
help='Expand the Active Directory Administrator for the server.')

with self.argument_context('sql server list') as c:
c.argument('expand_ad_admin',
options_list=['--expand-ad-admin'],
help='Expand the Active Directory Administrator for the server.')

with self.argument_context('sql server restore') as c:
c.argument('location',
arg_type=get_location_type_with_default_from_resource_group(self.cli_ctx))

# Create args that will be used to build up the Server object
create_args_for_complex_type(
c, 'parameters', Server, [
'administrator_login',
'administrator_login_password',
'location',
'minimal_tls_version'
])

with self.argument_context('sql server show') as c:
c.argument('expand_ad_admin',
options_list=['--expand-ad-admin'],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command_group(
"sql server",
)
class __CMDGroup(AAZCommandGroup):
"""Manage Server
"""
pass


__all__ = ["__CMDGroup"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from .__cmd_group import *
from ._create import *
from ._delete import *
from ._list import *
from ._show import *
from ._update import *
Loading
Loading