Skip to content

Commit

Permalink
{ServiceConnector-Passwordless} Fix Fabric SQL target interactive mode (
Browse files Browse the repository at this point in the history
#8503)

* Args for fabric

* Fix comment

* Expose new fields

* Add params related to target ID for Fabric SQL

* Fix versioning

* Add params to extension

---------

Co-authored-by: Tony Chen (DevDiv) <[email protected]>
  • Loading branch information
Tonychen0227 and Tony Chen (DevDiv) authored Feb 27, 2025
1 parent dfd6e4c commit dba1cc1
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/serviceconnector-passwordless/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Release History
===============
3.3.0
++++++
* Fix issue with params to support interactive mode for Fabric SQL

3.2.0
++++++
* Introduce support for Fabric SQL as a target service. Introduce new `connstr_props` argument to configure Fabric SQL.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
add_client_type_argument,
add_connection_name_argument,
add_source_resource_block,
add_target_resource_block,
add_new_addon_argument,
add_vnet_block,
add_connection_string_argument,
Expand Down Expand Up @@ -61,6 +60,29 @@ def add_auth_block(context, source, target):
context.ignore(arg)


def add_target_resource_block(context, target):
target_args = TARGET_RESOURCES_PARAMS.get(target)
for resource, args in TARGET_RESOURCES_PARAMS.items():
if resource != target:
for arg in args:
if arg not in target_args:
context.ignore(arg)

required_args = []
if target in TARGET_RESOURCES_PARAMS:
for arg, content in TARGET_RESOURCES_PARAMS.get(target).items():
context.argument(arg, options_list=content.get('options'), type=str,
help='{}. Required if \'--target-id\' is not specified.'.format(content.get('help')))
required_args.append(content.get('options')[0])

context.argument('target_id', type=str,
help='The resource id of target service. Required if {required_args} '
'are not specified.'.format(required_args=str(required_args)))

if target != RESOURCE.KeyVault:
context.ignore('enable_csi')


def load_arguments(self, _):
source = RESOURCE.Local
for target in TARGET_RESOURCES_PARAMS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,15 @@
}
},
RESOURCE.FabricSql: {
'connstr_props': {
'options': ['--connstr-props'],
'help': 'Connection string properties of the Fabric SQL server. Format like: --connstr-props "Server=<Server_Host>,<Port>" "Database=<Database_Name>".',
'placeholder': 'Server=MyServer,1433 Database=MyDB'
'fabric_workspace_uuid': {
'options': ['--fabric-workspace-uuid'],
'help': 'UUID of Fabric workspace which contains the target SQL database',
'placeholder': 'TargetFabricWorkspaceUUID'
},
'fabric_sql_db_uuid': {
'options': ['--fabric-sql-db-uuid'],
'help': 'UUID of the target Fabric SQL database',
'placeholder': 'TargetFabricSQLDatabaseUUID'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
# --------------------------------------------------------------------------------------------


VERSION = '3.2.0'
VERSION = '3.3.0'
NAME = 'serviceconnector-passwordless'
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ def connection_create_ext(cmd, client,
spring=None, app=None, deployment='default', # Resource.SpringCloud
# Resource.*Postgres, Resource.*Sql*
server=None, database=None,
# Resource.FabricSQL
connstr_props=None,
fabric_workspace_uuid=None,
fabric_sql_db_uuid=None,
**kwargs,
):
from azure.cli.command_modules.serviceconnector.custom import connection_create_func
Expand All @@ -54,6 +57,8 @@ def connection_create_ext(cmd, client,
opt_out_list=opt_out_list,
app_config_id=app_config_id,
connstr_props=connstr_props,
fabric_workspace_uuid=fabric_workspace_uuid,
fabric_sql_db_uuid=fabric_sql_db_uuid,
**kwargs)


Expand Down
2 changes: 1 addition & 1 deletion src/serviceconnector-passwordless/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
logger.warn("Wheel is not available, disabling bdist_wheel hook")


VERSION = '3.2.0'
VERSION = '3.3.0'
try:
from azext_serviceconnector_passwordless.config import VERSION
except ImportError:
Expand Down

0 comments on commit dba1cc1

Please sign in to comment.