Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IoT] DPS track 2 update, access-policy deprecation, and linked-hub parameter changes #20682

Merged
merged 11 commits into from
Dec 30, 2021

Conversation

c-ryan-k
Copy link
Member

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

Description

Updates DPS azure-mgmt-iothubprovisioningservices to track 2 SDK and adds convenience arguments to iot dps linked-hub create
Also begins the process of deprecating iot dps access-policy in favor of iot dps policy namespace for policy commands.

Testing Guide

Test new iot dps policy commands to replace all iot dps access-policy commands by simply replacing access-policy with policy in the existing commands.

Test using iot dps linked-hub create to link an IoT Hub to a DPS instance with new convenience arguments:
--connection_string, --hub_name, and --hub_resource_group_name

History Notes

[IoT] az iot dps access-policy: Being replaced with az iot dps policy
[IoT] az iot dps linked-hub create: Add convenience arguments for linking hubs.


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

c-ryan-k and others added 5 commits September 1, 2021 15:38
* Change rg to be optional
Deprecate access-policy to policy
Add hub name parameter options to linked hub
Bucket arguments

* support name or host name in linked hub

* update wording to have DPS later

* update expiration
@zhoxing-ms zhoxing-ms self-assigned this Dec 13, 2021
@c-ryan-k c-ryan-k marked this pull request as ready for review December 20, 2021 08:07
@c-ryan-k
Copy link
Member Author

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

@yonzhan yonzhan added this to the Dec 2021 (2022-01-04) milestone Dec 23, 2021
@yonzhan
Copy link
Collaborator

yonzhan commented Dec 23, 2021

Add @jsntcy to help with

Comment on lines +36 to +37
val = re.sub(r'[S|s]hared[A|a]ccess[K|k]ey=([^\*].+=)', 'SharedAccessKey={}'
.format(MOCK_KEY), val, flags=re.IGNORECASE)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add some comments or samples to explain the regular expression to increase it's readability?

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, though these are just for removing SAS keys from our recorded tests.
The typical connection string response is SharedAccessKey=*** but one of our calls is either using (SDK) or receiving (service) keys in lowercase - sharedaccesskey=*** - and this just stops them from appearing in the test recordings. I can add comments to the function.

Comment on lines +50 to +51
val = re.sub(br'[S|s]hared[A|a]ccess[K|k]ey=([^\*].+=)', 'SharedAccessKey={}'
.format(MOCK_KEY).encode(), val, flags=re.IGNORECASE)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

@zhoxing-ms zhoxing-ms merged commit 1c11174 into Azure:dev Dec 30, 2021
with self.command_group('iot dps access-policy',
client_factory=iot_service_provisioning_factory,
deprecate_info=self.deprecate(redirect='iot dps policy',
expiration='2.35.0')
Copy link
Member

Choose a reason for hiding this comment

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

The expiration causes lots of failures in CI after Azure CLI is updated to 2.35.0:

https://dev.azure.com/azure-sdk/public/_build/results?buildId=1475423&view=logs&j=168ccbe3-da49-5c0b-6478-08f7016e4bf5&t=10a595be-4223-5cc7-9a73-012871b6eaee

-  FAIL - HIGH severity: faulty_help_example_parameters_rule
    Help-Entry: `iot dps access-policy create` - 
	There is a violation:
	"az iot dps access-policy create --dps-name MyDps --resource-group MyResourceGroup --name MyPolicy --rights EnrollmentRead" is not a valid command.
	argument _subcommand: unknown parser 'access-policy' (choices: list, show, create, delete, update, linked-hub, certificate, policy).
...
-  FAIL - HIGH severity: expired_command_group
    Command-Group: `iot dps access-policy` - Deprecated command group is expired and should be removed.
...
-  FAIL - HIGH severity: missing_command_help
    Command: `iot dps access-policy create` - Missing help
    Command: `iot dps access-policy delete` - Missing help
    Command: `iot dps access-policy list` - Missing help
    Command: `iot dps access-policy show` - Missing help
    Command: `iot dps access-policy update` - Missing help

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.

6 participants