Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
a2f6b6c
Initial updates to use track 2 Hub GA SDK
c-ryan-k Mar 3, 2021
45cadfb
WIP initial user-assigned identity functionality
c-ryan-k Mar 16, 2021
2acf8e6
Added routing endpoint identity and added some preliminary test code
c-ryan-k Mar 17, 2021
b613397
Updated identity code with enums and minor logic updates
c-ryan-k Mar 18, 2021
b3208a4
More identity updates, role and scope assignment
c-ryan-k Mar 18, 2021
ee48812
Minor fixes to identity functions and return values
c-ryan-k Mar 19, 2021
ee807a0
Linting fixes
c-ryan-k Mar 19, 2021
ea84c66
WIP testing updates
c-ryan-k Mar 19, 2021
44117af
Merge branch 'azure-dev' into hub_track2
c-ryan-k Mar 26, 2021
fa2dbb8
Help/Param updates and minor tweaks/fixes
c-ryan-k Mar 30, 2021
691950d
Test updates, help updates, polling updates
c-ryan-k Mar 30, 2021
8fc4f2e
Test recording updates
c-ryan-k Mar 31, 2021
1282c05
test updates
c-ryan-k Apr 6, 2021
0a76443
minor fix in consumer_group_create, test updates
c-ryan-k Apr 6, 2021
5060def
Initial updates to use track 2 Hub GA SDK
c-ryan-k Mar 3, 2021
14fa27d
WIP initial user-assigned identity functionality
c-ryan-k Mar 16, 2021
bc5e641
Added routing endpoint identity and added some preliminary test code
c-ryan-k Mar 17, 2021
8779d9a
Updated identity code with enums and minor logic updates
c-ryan-k Mar 18, 2021
889f42c
More identity updates, role and scope assignment
c-ryan-k Mar 18, 2021
90342f9
Minor fixes to identity functions and return values
c-ryan-k Mar 19, 2021
9b25700
Linting fixes
c-ryan-k Mar 19, 2021
850ab5e
WIP testing updates
c-ryan-k Mar 19, 2021
a65084e
Help/Param updates and minor tweaks/fixes
c-ryan-k Mar 30, 2021
c92c45f
Test updates, help updates, polling updates
c-ryan-k Mar 30, 2021
5f5e1e2
Test recording updates
c-ryan-k Mar 31, 2021
df59fbf
test updates
c-ryan-k Apr 6, 2021
e6308da
minor fix in consumer_group_create, test updates
c-ryan-k Apr 6, 2021
47e700a
Merge branch 'hub_track2' of https://github.com/c-ryan-k/azure-cli in…
c-ryan-k Apr 12, 2021
0214f61
Test updates and new recordings
c-ryan-k Apr 12, 2021
3ea6fc4
Merge branch 'azure-dev' into hub_track2
c-ryan-k Apr 20, 2021
a29fe37
Fix for ARM issue - user identity object must be empty upon removal o…
c-ryan-k Apr 27, 2021
1a0ceeb
Updates to use stable multiapi SDK (2021-03-03) with backfill for dev…
c-ryan-k Apr 28, 2021
d1b5f0d
Merge branch 'dev' into hub_track2
c-ryan-k Apr 28, 2021
ef103b3
Help/Param string updates
c-ryan-k Apr 28, 2021
fb759e6
Version fix for new SDK (2021-03-31)
c-ryan-k Apr 29, 2021
bdc3f5a
Parameter updates
c-ryan-k May 11, 2021
a599f8b
Test and recording updates
c-ryan-k May 11, 2021
cd59e5a
Certificate create/update fixes and test updates
c-ryan-k May 11, 2021
4e8d6a3
Add DeviceConnectionStateEvents as a routing source type
c-ryan-k May 13, 2021
0ab2ae5
RoutingSource test updates
c-ryan-k May 14, 2021
20992a8
SDK version update to 2.0.0
c-ryan-k May 14, 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
Prev Previous commit
Next Next commit
Help/Param updates and minor tweaks/fixes
  • Loading branch information
c-ryan-k committed Apr 9, 2021
commit a65084e7683d75104e420ec8746213deb1852a67
43 changes: 42 additions & 1 deletion src/azure-cli/azure/cli/command_modules/iot/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,9 @@
- name: Create an IoT Hub with the standard pricing tier S1 and 4 partitions, in the 'westus' region, with tags.
text: >
az iot hub create --resource-group MyResourceGroup --name MyIotHub --location westus --tags a=b c=d
- name: Create an IoT Hub with a system-assigned identity, and assign a role and scope to a storage account for the created system identity.
text: >
az iot hub create --resource-group MyResourceGroup --name MyIotHub --location westus --assign-identity [system] --role "Storage Blob Data Contributor" --scopes {resourceId}
"""

helps['iot hub delete'] = """
Expand All @@ -428,6 +431,44 @@
az iot hub devicestream show -n MyIotHub
"""

helps['iot hub identity'] = """
type: group
short-summary: Manage identities of an Azure IoT hub.
"""

helps['iot hub identity assign'] = """
type: command
short-summary: Assign identities to an IoT Hub
examples:
- name: Assign a user-assigned identity to an IoT Hub
text: >
az iot hub identity assign --name MyIoTHub --resource-group MyResourceGroup --identities {resourceId}
- name: Assign a system-assigned identity to an IoT Hub and assign a role to that identity.
text: >
az iot hub identity assign --name MyIoTHub --resource-group MyResourceGroup --identities [system] --role "Storage Blob Data Contributor" --scopes {resourceId}
"""

helps['iot hub identity show'] = """
type: command
short-summary: Show the identity properties of an IoT Hub
examples:
- name: Show identity properties of an IoT Hub
text: >
az iot hub identity show --name MyIoTHub --resource-group MyResourceGroup
"""

helps['iot hub identity remove'] = """
type: command
short-summary: Remove identities from an IoT Hub
examples:
- name: Remove a user-assigned identity to an IoT Hub
text: >
az iot hub identity remove --name MyIoTHub --resource-group MyResourceGroup --identities {resourceId}
- name: Remove a system-assigned identity from an IoT Hub.
text: >
az iot hub identity remove --name MyIoTHub --resource-group MyResourceGroup --identities [system]
"""

helps['iot hub list'] = """
type: command
short-summary: List IoT hubs.
Expand Down Expand Up @@ -781,7 +822,7 @@
az iot hub update --name MyIoTHub --feedback-max-delivery-count 20 --feedback-lock-duration 100 --feedback-ttl 4
- name: Update the IoT Hub file upload settings
text: >
az iot hub update -n MyIoTHub --fileupload-sas-ttl 5 --fileupload-storage-auth-type identityBased
az iot hub update -n MyIoTHub --fileupload-sas-ttl 5 --fileupload-storage-auth-type identityBased --fileupload-storage-identity [system]
- name: Update the IoT Hub file upload notification settings
text: >
az iot hub update -n MyIoTHub --fileupload-notification-max-delivery-count 50
Expand Down
3 changes: 2 additions & 1 deletion src/azure-cli/azure/cli/command_modules/iot/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ def load_arguments(self, _): # pylint: disable=too-many-statements
' between 1 and 24 hours.')
c.argument('fileupload_storage_identity',
options_list=['--fileupload-storage-identity', '--fsi'],
help='The managed identity to use for file upload authentication.')
help="The managed identity to use for file upload authentication. Use '[system]' to "
"refer to the system-assigned identity or a resource ID to refer to a user-assigned identity.")
c.argument('min_tls_version', options_list=['--min-tls-version', '--mintls'],
type=str, help='Specify the minimum TLS version to support for this hub. Can be set to'
' "1.2" to have clients that use a TLS version below 1.2 to be rejected.')
Expand Down
9 changes: 6 additions & 3 deletions src/azure-cli/azure/cli/command_modules/iot/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ def setter(hub):
else:
hub.identity.type = IdentityType.user_assigned.value if hub.identity.user_assigned_identities else IdentityType.none.value

# TODO - remove if not necessary
hub.identity.user_assigned_identities = hub.identity.user_assigned_identities or None
poller = client.iot_hub_resource.begin_create_or_update(resource_group_name, hub_name, hub, {'IF-MATCH': hub.etag})
return LongRunningOperation(cmd.cli_ctx)(poller)
Expand Down Expand Up @@ -819,8 +820,7 @@ def iot_hub_routing_endpoint_create(cmd, client, hub_name, endpoint_name, endpoi
identity=None):
resource_group_name = _ensure_resource_group_name(client, resource_group_name, hub_name)
hub = iot_hub_get(cmd, client, hub_name, resource_group_name)

if identity and authentication_type != AuthenticationType.IDENTITY_BASED:
if identity and authentication_type.lower() != AuthenticationType.IdentityBased.value:
raise CLIError("In order to use an identity for authentication, you must select --auth-type as 'identityBased'")

if EndpointType.EventHub.value == endpoint_type.lower():
Expand Down Expand Up @@ -881,8 +881,11 @@ def iot_hub_routing_endpoint_create(cmd, client, hub_name, endpoint_name, endpoi
identity=ManagedIdentity(user_assigned_identity=identity) if identity not in [IdentityType.none.value, SYSTEM_IDENTITY] else None
)
)
return client.iot_hub_resource.begin_create_or_update(resource_group_name, hub_name, hub, {'IF-MATCH': hub.etag})

# TODO : remove if not necessary
hub.identity.user_assigned_identities = hub.identity.user_assigned_identities or None

return client.iot_hub_resource.begin_create_or_update(resource_group_name, hub_name, hub, {'IF-MATCH': hub.etag})

def iot_hub_routing_endpoint_list(cmd, client, hub_name, endpoint_type=None, resource_group_name=None):
resource_group_name = _ensure_resource_group_name(client, resource_group_name, hub_name)
Expand Down