Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SQL] Bump sdk version #18373

Merged
merged 51 commits into from
Jun 24, 2021
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
4dc4fec
Bump sdk version
strehan1993 Jun 7, 2021
ed94334
Switch to LongTermRetentionPolicies
strehan1993 Jun 7, 2021
974197c
Fix sql db threat-policy
strehan1993 Jun 7, 2021
98e01c4
some test fixes
strehan1993 Jun 7, 2021
be7f737
Fix threat detection
strehan1993 Jun 7, 2021
a597a4e
re-record test_sql_server_security_mgmt
strehan1993 Jun 8, 2021
8bbd2c5
Merge branch 'dev' into wmt
strehan1993 Jun 8, 2021
d31effe
Fix tde tests
strehan1993 Jun 9, 2021
879dd77
add more passing tests
strehan1993 Jun 9, 2021
1d2056b
fix ltr test
strehan1993 Jun 9, 2021
90ad543
Fix elastic pool
strehan1993 Jun 9, 2021
cc2e65e
fix sql mi aad tests
strehan1993 Jun 9, 2021
910554a
Failover group
strehan1993 Jun 9, 2021
655c14a
fix firewall rule
strehan1993 Jun 9, 2021
f6e4ca1
Fix for tde byok
strehan1993 Jun 9, 2021
a65282f
push test file
strehan1993 Jun 10, 2021
b17f89c
Skip MI tests
strehan1993 Jun 10, 2021
123f455
skip server trust groups
strehan1993 Jun 10, 2021
bf5b73d
Add dns alias management
strehan1993 Jun 14, 2021
b5e813e
fix backupstorageredundancy
strehan1993 Jun 14, 2021
00e1e84
backupstorage related fixes
strehan1993 Jun 14, 2021
22eb890
Push test files
strehan1993 Jun 14, 2021
d81e3ee
Fix test_sql_db_sensitivity_classifications, skip instance pools
strehan1993 Jun 15, 2021
4dba8bf
Push sens classification re-record
strehan1993 Jun 15, 2021
999c005
retry sensitivity test
strehan1993 Jun 15, 2021
b95c63f
Fix instance group failover management
strehan1993 Jun 15, 2021
7420e68
restore db test passing
xaliciayang Jun 17, 2021
4050b51
record restore deleted
xaliciayang Jun 18, 2021
bf9fe76
skip restore deleted and classification
strehan1993 Jun 18, 2021
118d9d8
management endpoint
xaliciayang Jun 18, 2021
738c4a4
Merge branch 'wmt' of https://github.com/strehan1993/azure-cli into wmt
xaliciayang Jun 18, 2021
9907c7d
remove skip tag
xaliciayang Jun 18, 2021
9b6502a
rerecord import export
xaliciayang Jun 20, 2021
deff7e6
modify validators to separate db and MI
xaliciayang Jun 21, 2021
df8756d
change back MI to expect LRS/ZRS/GRS
xaliciayang Jun 21, 2021
3225c89
Add CMK changes
viparek Jun 22, 2021
f5a4685
Fix linter and style issues
viparek Jun 22, 2021
f97f2fa
remove current_bsr from create params
xaliciayang Jun 22, 2021
e04c85e
Merge pull request #1 from strehan1993/viparek/cmk
strehan1993 Jun 22, 2021
2440513
Fix failure due to --ids
strehan1993 Jun 23, 2021
cc2d4c5
more fixes, tests and linter
strehan1993 Jun 23, 2021
3908cc4
More linter issues
strehan1993 Jun 23, 2021
980dd23
External admin changes
strehan1993 Jun 23, 2021
9a0fc24
Style and Linter fixes
strehan1993 Jun 23, 2021
2d4cf83
Fix show command
strehan1993 Jun 23, 2021
1ab342e
Fix more style issues
strehan1993 Jun 23, 2021
e0e6f5b
Add help for external admin
strehan1993 Jun 23, 2021
156e69d
linter fix
strehan1993 Jun 24, 2021
bfd969a
Add examples for CMK with UMI
viparek Jun 24, 2021
0a2834f
Merge pull request #2 from strehan1993/viparek/addhelp
strehan1993 Jun 24, 2021
bca0525
more linter fixes
strehan1993 Jun 24, 2021
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
7 changes: 3 additions & 4 deletions src/azure-cli/azure/cli/command_modules/sql/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,16 +244,15 @@ def elastic_pool_transform(result):
'''
Transforms the json response for an elastic pool.
'''
from azure.mgmt.sql.models import ElasticPoolEdition

# Add properties in order to improve backwards compatibility with api-version 2014-04-01
result.edition = result.sku.tier
result.storageMb = result.max_size_bytes / 1024 / 1024

is_dtu = result.sku.tier in (
ElasticPoolEdition.basic.value,
ElasticPoolEdition.standard.value,
ElasticPoolEdition.premium.value)
'Basic',
'Standard',
'Premium')
strehan1993 marked this conversation as resolved.
Show resolved Hide resolved

result.dtu = result.sku.capacity if is_dtu else None
result.database_dtu_min = int(result.per_database_settings.min_capacity) if is_dtu else None
Expand Down
4 changes: 1 addition & 3 deletions src/azure-cli/azure/cli/command_modules/sql/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
ElasticPoolLicenseType,
SampleName,
SecurityAlertPolicyState,
SecurityAlertPolicyEmailAccountAdmins,
ServerConnectionType,
ServerKeyType,
StorageKeyType,
Expand Down Expand Up @@ -940,8 +939,7 @@ def _configure_security_policy_storage_params(arg_ctx):
c.argument('email_account_admins',
arg_group=notification_arg_group,
options_list=['--email-account-admins'],
help='Whether the alert is sent to the account administrators.',
arg_type=get_enum_type(SecurityAlertPolicyEmailAccountAdmins))
help='Whether the alert is sent to the account administrators.')

# TODO: use server default

Expand Down
4 changes: 2 additions & 2 deletions src/azure-cli/azure/cli/command_modules/sql/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def get_sql_database_sensitivity_labels_operations(cli_ctx, _):


def get_sql_database_threat_detection_policies_operations(cli_ctx, _):
return get_sql_management_client(cli_ctx).database_threat_detection_policies
return get_sql_management_client(cli_ctx).database_security_alert_policies


def get_sql_database_transparent_data_encryption_activities_operations(cli_ctx, _):
Expand Down Expand Up @@ -201,7 +201,7 @@ def get_sql_managed_database_long_term_retention_backups_operations(cli_ctx, _):


def get_sql_database_long_term_retention_policies_operations(cli_ctx, _):
return get_sql_management_client(cli_ctx).backup_long_term_retention_policies
return get_sql_management_client(cli_ctx).long_term_retention_policies


def get_sql_database_long_term_retention_backups_operations(cli_ctx, _):
Expand Down
4 changes: 2 additions & 2 deletions src/azure-cli/azure/cli/command_modules/sql/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def load_command_table(self, _):
g.custom_wait_command('wait', 'server_ms_support_audit_policy_get')

database_long_term_retention_policies_operations = CliCommandType(
operations_tmpl='azure.mgmt.sql.operations#BackupLongTermRetentionPoliciesOperations.{}',
operations_tmpl='azure.mgmt.sql.operations#LongTermRetentionPoliciesOperations.{}',
client_factory=get_sql_database_long_term_retention_policies_operations)

with self.command_group('sql db ltr-policy',
Expand Down Expand Up @@ -346,7 +346,7 @@ def load_command_table(self, _):
g.command('disable', 'disable_recommendation')

database_threat_detection_policies_operations = CliCommandType(
operations_tmpl='azure.mgmt.sql.operations#DatabaseThreatDetectionPoliciesOperations.{}',
operations_tmpl='azure.mgmt.sql.operations#DatabaseSecurityAlertPoliciesOperations.{}',
client_factory=get_sql_database_threat_detection_policies_operations)

with self.command_group('sql db threat-policy',
Expand Down
25 changes: 12 additions & 13 deletions src/azure-cli/azure/cli/command_modules/sql/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
IdentityType,
PartnerInfo,
PerformanceLevelUnit,
ReplicationRole,
FailoverGroupReplicationRole,
ResourceIdentity,
SecurityAlertPolicyState,
SensitivityLabel,
Expand All @@ -41,7 +41,8 @@
InstanceFailoverGroupReadOnlyEndpoint,
InstanceFailoverGroupReadWriteEndpoint,
ServerPublicNetworkAccess,
ServerInfo
ServerInfo,
EncryptionProtector
)

from azure.cli.core.profiles import ResourceType
Expand Down Expand Up @@ -1135,7 +1136,7 @@ def db_failover(

# If a replica is primary, then it has 1 or more links (to its secondaries).
# If a replica is secondary, then it has exactly 1 link (to its primary).
primary_link = next((link for link in links if link.partner_role == ReplicationRole.primary), None)
primary_link = next((link for link in links if link.partner_role == FailoverGroupReplicationRole.primary), None)
if not primary_link:
# No link to a primary, so this must already be a primary. Do nothing.
return
Expand Down Expand Up @@ -2794,10 +2795,10 @@ def db_threat_detection_policy_update(
instance.retention_days = retention_days

if email_addresses:
instance.email_addresses = ";".join(email_addresses)
instance.email_addresses = email_addresses

if disabled_alerts:
instance.disabled_alerts = ";".join(disabled_alerts)
instance.disabled_alerts = disabled_alerts

if email_account_admins:
instance.email_account_admins = email_account_admins
Expand Down Expand Up @@ -3482,11 +3483,8 @@ def server_key_create(
resource_group_name=resource_group_name,
server_name=server_name,
key_name=key_name,
parameters=ServerKey(
server_key_type=ServerKeyType.azure_key_vault.value,
uri=kid
)
)
server_key_type='AzureKeyVault',
uri=kid)


def server_key_get(
Expand Down Expand Up @@ -3606,9 +3604,10 @@ def encryption_protector_update(
return client.create_or_update(
resource_group_name=resource_group_name,
server_name=server_name,
server_key_type=server_key_type,
server_key_name=key_name
)
encryption_protector_name='Current',
parameters=EncryptionProtector(server_key_type=server_key_type,
server_key_name=key_name,
auto_rotation_enabled=False))

#####
# sql server aad-only
Expand Down
Loading