Skip to content

Commit 1126901

Browse files
mattboentoroMatthew Boentoro
andauthored
{RDBMS} az postgres flexible-server identity update: Cannot disable SAMI when Fabric Mirroring is enabled (#30971)
Co-authored-by: Matthew Boentoro <mboentoro@microsoft.com>
1 parent 9632cf3 commit 1126901

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/azure-cli/azure/cli/command_modules/rdbms/flexible_server_custom_postgres.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
cf_postgres_check_resource_availability_with_location, \
2929
cf_postgres_flexible_private_dns_zone_suffix_operations, \
3030
cf_postgres_flexible_private_endpoint_connections, \
31-
cf_postgres_flexible_tuning_options
31+
cf_postgres_flexible_tuning_options, cf_postgres_flexible_config
3232
from ._flexible_server_util import generate_missing_parameters, resolve_poller, \
3333
generate_password, parse_maintenance_window, get_current_time, build_identity_and_data_encryption, \
3434
_is_resource_name, get_tenant_id, get_case_insensitive_key_value, get_enum_value_true_false
@@ -942,9 +942,14 @@ def flexible_server_identity_update(cmd, client, resource_group_name, server_nam
942942
# if user-assigned identity is enabled, then enable both system-assigned and user-assigned identity
943943
identity_type = 'SystemAssigned,UserAssigned'
944944
else:
945+
# check if fabric is enabled
946+
config_client = cf_postgres_flexible_config(cmd.cli_ctx, '_')
947+
fabric_mirror_status = config_client.get(resource_group_name, server_name, 'azure.fabric_mirror_enabled')
948+
if (fabric_mirror_status and fabric_mirror_status.value.lower() == 'on'):
949+
raise CLIError("On servers for which Fabric mirroring is enabled, system assigned managed identity cannot be disabled.")
945950
if server.data_encryption.type == 'AzureKeyVault':
946951
# if data encryption is enabled, then system-assigned identity cannot be disabled
947-
raise CLIError("Disabling system-assigned identity isn't supported on servers configured to use customer managed keys for data encryption.")
952+
raise CLIError("On servers for which data encryption is based on customer managed key, system assigned managed identity cannot be disabled.")
948953
if identity_type == 'SystemAssigned,UserAssigned':
949954
# if both system-assigned and user-assigned identity is enabled, then disable system-assigned identity
950955
identity_type = 'UserAssigned'

0 commit comments

Comments
 (0)