Skip to content

Conversation

@c-ryan-k
Copy link
Member

@c-ryan-k c-ryan-k commented Dec 2, 2021

Description

This PR fixes a bug where a hub without a default storage endpoint cannot be updated with az iot hub update, and also shows an error if the user attempts to update file upload settings on a hub missing this required endpoint.

Fixes #20004

Testing Guide

If your hub has no default storage endpoint (properties.storageEndpoints[$default]), you should still be able to update other properties of the hub using az iot hub update [--param or --set], however if you attempt to update file-upload endpoint-specific settings (container name, connection string, sas_ttl, identity, etc), you will receive the following error:

This hub has no default storage endpoint for file upload.
Please recreate your default storage endpoint by running "az iot hub update --name {hub_name} --fcs {storage_connection_string} --fc {storage_container_name}"

History Notes

[IoT] az iot hub update: Adds error handling for file-upload parameters and fixes empty $default storage endpoint errors


This checklist is used to make sure that common guidelines for a pull request are followed.

@jiasli jiasli added this to the Backlog milestone Dec 3, 2021
@c-ryan-k c-ryan-k marked this pull request as ready for review December 8, 2021 23:18
@c-ryan-k c-ryan-k requested a review from zhoxing-ms as a code owner December 8, 2021 23:18
@c-ryan-k c-ryan-k requested a review from digimaun December 8, 2021 23:19
Comment on lines 589 to 591
raise AzCLIError('This hub has no default storage endpoint for file upload.\n'
'Please recreate your default storage endpoint by running '
'`az iot hub update --name {hub_name} --fcs {storage_connection_string} --fc {storage_container_name}`')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use the UserFault instead of AzCLIError ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure - this one's a bit tough because I'm not sure what the correct error class would be - technically it is a user fault for trying to modify a storage endpoint that doesn't exist, but in the context of the command, the fault would be an RequiredArgumentMissingError.

For the time being we can classify it as an UnclassifiedUserFault since it's more complicated than just incorrect arguments or a misconfigured resource.

@c-ryan-k
Copy link
Member Author

c-ryan-k commented Dec 21, 2021

@zhoxing-ms Can we get this into the current milestone targeted for a January release?

@zhoxing-ms zhoxing-ms merged commit d18048c into Azure:dev Dec 27, 2021
@zhoxing-ms
Copy link
Contributor

@c-ryan-k OK, this PR has been merged and will be released on 2022-01-04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

az iot hub update --set identity.type="SystemAssigned" is not working

5 participants