Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/azure-cli/azure/cli/command_modules/sql/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
short-summary: Update long term retention settings for a database.
examples:
- name: Set long term retention for a database.
text: az sql db ltr-policy set -g mygroup -s myserver -n mydb --weekly-retention "P1W" --monthly-retention "P6M" --yearly-retention "P1Y" --week-of-year 26 --access-tier "Archive" --make-backups-immutable true
text: az sql db ltr-policy set -g mygroup -s myserver -n mydb --weekly-retention "P1W" --monthly-retention "P6M" --yearly-retention "P1Y" --week-of-year 26 --make-backups-immutable true
"""

helps['sql db ltr-policy show'] = """
Expand Down
9 changes: 1 addition & 8 deletions src/azure-cli/azure/cli/command_modules/sql/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -1307,8 +1307,7 @@ def _configure_security_policy_storage_params(arg_ctx):
'monthly_retention',
'yearly_retention',
'week_of_year',
'make_backups_immutable',
'backup_storage_access_tier'])
'make_backups_immutable'])

c.argument('weekly_retention',
help='Retention for the weekly backup. '
Expand All @@ -1332,12 +1331,6 @@ def _configure_security_policy_storage_params(arg_ctx):
help='Whether to make the LTR backups immutable.',
arg_type=get_three_state_flag())

c.argument('backup_storage_access_tier',
options_list=['--access-tier', '--backup-storage-access-tier'],
arg_type=get_enum_type(["Hot", "Archive"]),
help='The access tier of a LTR backup.'
'Possible values = [Hot, Archive]')

with self.argument_context('sql db ltr-backup') as c:
c.argument('location_name',
required=True,
Expand Down
10 changes: 0 additions & 10 deletions src/azure-cli/azure/cli/command_modules/sql/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@

logger = get_logger(__name__)

BACKUP_STORAGE_ACCESS_TIERS = ["hot",
"archive"]

###############################################
# Common funcs #
###############################################
Expand Down Expand Up @@ -3080,7 +3077,6 @@ def update_long_term_retention(
yearly_retention=None,
week_of_year=None,
make_backups_immutable=None,
backup_storage_access_tier=None,
**kwargs):
'''
Updates long term retention for managed database
Expand All @@ -3098,10 +3094,6 @@ def update_long_term_retention(
if not confirmation:
return

if backup_storage_access_tier and backup_storage_access_tier.lower() not in BACKUP_STORAGE_ACCESS_TIERS:
raise CLIError('Please specify a valid backup storage access tier type for backup storage access tier.'
'See \'--help\' for more details.')

kwargs['weekly_retention'] = weekly_retention

kwargs['monthly_retention'] = monthly_retention
Expand All @@ -3112,8 +3104,6 @@ def update_long_term_retention(

kwargs['make_backups_immutable'] = make_backups_immutable

kwargs['backup_storage_access_tier'] = backup_storage_access_tier

policy = client.begin_create_or_update(
database_name=database_name,
server_name=server_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,6 @@ def test_sql_db_long_term_retention(
'yearly_retention': 'P2M',
'week_of_year': 12,
'make_backups_immutable': 'False',
'backup_storage_access_tier': 'Archive',
'encryption_protector' : 'https://test123343strehan.vault.azure.net/keys/testk1/604b0e26e2a24eeaab30b80c8d7bb1c1',
'keys' : '"https://test123343strehan.vault.azure.net/keys/k2/66f51a6e70f04067af8eaf77805e88b1" "https://test123343strehan.vault.azure.net/keys/testk1/604b0e26e2a24eeaab30b80c8d7bb1c1" "https://test123343strehan.vault.azure.net/keys/testk1/96151496df864e32aa62a3c1857b2931"',
'umi' : '/subscriptions/e1775f9f-a286-474d-b6f0-29c42ac74554/resourcegroups/ArmTemplate/providers/Microsoft.ManagedIdentity/userAssignedIdentities/shobhittest'
Expand All @@ -1289,14 +1288,12 @@ def test_sql_db_long_term_retention(
' --weekly-retention {weekly_retention} --monthly-retention {monthly_retention}'
' --yearly-retention {yearly_retention} --week-of-year {week_of_year}'
' --make-backups-immutable {make_backups_immutable}',
' --access-tier {backup_storage_access_tier}',
checks=[
self.check('resourceGroup', '{rg}'),
self.check('weeklyRetention', '{weekly_retention}'),
self.check('monthlyRetention', '{monthly_retention}'),
self.check('yearlyRetention', '{yearly_retention}'),
self.check('makeBackupsImmutable', '{make_backups_immutable}'),
self.check('backupStorageAccessTier', '{backup_storage_access_tier}')])
self.check('makeBackupsImmutable', '{make_backups_immutable}')])

# test get long term retention policy on live database
self.cmd(
Expand All @@ -1306,8 +1303,7 @@ def test_sql_db_long_term_retention(
self.check('weeklyRetention', '{weekly_retention}'),
self.check('monthlyRetention', '{monthly_retention}'),
self.check('yearlyRetention', '{yearly_retention}'),
self.check('makeBackupsImmutable', '{make_backups_immutable}'),
self.check('backupStorageAccessTier', '{backup_storage_access_tier}')])
self.check('makeBackupsImmutable', '{make_backups_immutable}')])

# test list long term retention backups for location
# with resource group
Expand Down
Loading