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
6 changes: 0 additions & 6 deletions src/azure-cli/azure/cli/command_modules/sqlvm/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,6 @@ def _validate_azure_ad_authentication_supported_on_sqlvm(cli_ctx, namespace):
except Exception as ex:
raise InvalidArgumentValueError("Unable to validate Azure AD authentication due to retrieving SQL VM instance encountering an error: {}.".format(ex)) from ex

logger.debug("The SQL VM managment mode is %s.", sqlvm.sql_management)
if sqlvm.sql_management != "Full":
az_error = InvalidArgumentValueError("Enabling Azure AD authentication requires Full SQL VM management mode")
az_error.set_recommendation("Upgrade SQL Server VM extension to Full mode.")
raise az_error

# Construct error message for unsupported SQL server version or OS platform.
unsupported_error = "Azure AD authentication requires SQL Server 2022 on Windows platform, but the SQL Image Offer of this SQL VM is {}".format(sqlvm.sql_image_offer)

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,8 @@ def test_sqlvm_aad_auth_negative(self, resource_group, resource_group_location,
covering the validation of Azure AD authentication
"""

# Test create sqlvm2019 with LightWeight management mode
self.cmd('sql vm create -n {} -g {} -l {} --license-type {} --sql-mgmt-type LightWeight'
# Test create sqlvm2019
self.cmd('sql vm create -n {} -g {} -l {} --license-type {}'
.format(sqlvm2019, resource_group, resource_group_location, 'PAYG'),
checks=[
JMESPathCheck('name', sqlvm2019),
Expand All @@ -741,14 +741,14 @@ def test_sqlvm_aad_auth_negative(self, resource_group, resource_group_location,
JMESPathCheck('sqlManagement', 'LightWeight')
]).get_output_in_json()

# Test create sqlvm2022 with Full management mode
self.cmd('sql vm create -n {} -g {} -l {} --license-type {} --sql-mgmt-type Full'
# Test create sqlvm2022
self.cmd('sql vm create -n {} -g {} -l {} --license-type {}'
.format(sqlvm2022, resource_group, resource_group_location, 'PAYG'),
checks=[
JMESPathCheck('name', sqlvm2022),
JMESPathCheck('location', resource_group_location),
JMESPathCheck('sqlServerLicenseType', 'PAYG'),
JMESPathCheck('sqlManagement', 'Full')
JMESPathCheck('sqlManagement', 'LightWeight')
]).get_output_in_json()

# Create user-assigned managed identity to attach to the virtual machine
Expand All @@ -758,19 +758,6 @@ def test_sqlvm_aad_auth_negative(self, resource_group, resource_group_location,
# Create user-assigned managed identity not attached to any virtual machine
unattached_identity = self.cmd('identity create -n {} -g {}'.format('other_msi', resource_group)).get_output_in_json()

# Assert customer cannot enable Azure AD authentication with LightWeight management mode
with self.assertRaisesRegex(InvalidArgumentValueError, "Enabling Azure AD authentication requires Full SQL VM management mode"):
self.cmd('sql vm validate-azure-ad-auth -n {} -g {}'.format(sqlvm2019, resource_group))

# test update sqlvm with management mode to make sure it updates to Full.
self.cmd('sql vm update -n {} -g {} --sql-mgmt-type {}'
.format(sqlvm2019, resource_group, 'Full'),
checks=[
JMESPathCheck('name', sqlvm2019),
JMESPathCheck('location', resource_group_location),
JMESPathCheck('sqlManagement', 'Full')
]).get_output_in_json()

# Test both enable and validate commands
commands = ["enable-azure-ad-auth", "validate-azure-ad-auth"]

Expand Down