Skip to content

Commit c24da6a

Browse files
committed
add in the min tls
1 parent 0f55c71 commit c24da6a

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/azure-cli/azure/cli/command_modules/iot/_params.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,9 @@ def load_arguments(self, _): # pylint: disable=too-many-statements
235235
"refer to the system-assigned managed identity or a resource ID to refer to a "
236236
"user-assigned managed identity.")
237237
c.argument('min_tls_version', options_list=['--min-tls-version', '--mintls'],
238-
type=str, help='Specify the minimum TLS version to support for this hub. Can be set to'
239-
' "1.2" to have clients that use a TLS version below 1.2 to be rejected.')
238+
type=str, help='Specify the minimum TLS version to support for this hub. Can be set to '
239+
'"1.0" or "1.2". For example, minimum TLS version set to "1.2" '
240+
'results in clients that use a TLS version below 1.2 to be rejected.')
240241
c.argument('tags', tags_type)
241242
c.argument('system_identity', options_list=['--mi-system-assigned'],
242243
arg_type=get_three_state_flag(),

src/azure-cli/azure/cli/command_modules/iot/custom.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,7 @@ def update_iot_hub_custom(instance,
636636
fileupload_storage_authentication_type=None,
637637
fileupload_storage_container_uri=None,
638638
fileupload_storage_identity=None,
639+
min_tls_version=None,
639640
tags=None):
640641
from datetime import timedelta
641642
if tags is not None:
@@ -668,6 +669,8 @@ def update_iot_hub_custom(instance,
668669
if fileupload_notification_ttl is not None:
669670
ttl = timedelta(hours=fileupload_notification_ttl)
670671
instance.properties.messaging_endpoints['fileNotifications'].ttl_as_iso8601 = ttl
672+
if min_tls_version is not None:
673+
instance.properties.min_tls_version = min_tls_version
671674
# only bother with $default storage endpoint checking if modifying fileupload params
672675
if any([
673676
fileupload_storage_connectionstring, fileupload_storage_container_name, fileupload_sas_ttl,

src/azure-cli/azure/cli/command_modules/iot/tests/latest/test_iot_commands.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,12 @@ def test_iot_hub(self, resource_group, resource_group_location, storage_account)
110110
self.cmd('iot hub update -n {0} -g {1} --fsi test/user/'.format(hub, rg), expect_failure=True)
111111

112112
# Test auth config settings
113-
updated_hub = self.cmd('iot hub update -n {0} -g {1} --disable-local-auth --disable-module-sas'.format(hub, rg)).get_output_in_json()
113+
updated_hub = self.cmd('iot hub update -n {0} -g {1} --disable-local-auth --disable-module-sas '
114+
'--min-tls-version 1.0'.format(hub, rg)).get_output_in_json()
114115
assert updated_hub['properties']['disableLocalAuth']
115116
assert not updated_hub['properties']['disableDeviceSas']
116117
assert updated_hub['properties']['disableModuleSas']
118+
assert updated_hub['properties']['minTlsVersion'] == '1.0'
117119

118120
updated_hub = self.cmd('iot hub update -n {0} -g {1} --disable-module-sas false --disable-device-sas'.format(hub, rg)).get_output_in_json()
119121
assert updated_hub['properties']['disableLocalAuth']

0 commit comments

Comments
 (0)