azure-sdk-for-python icon indicating copy to clipboard operation
azure-sdk-for-python copied to clipboard

Invoke relay_client.hybrid_connections.create_or_update_authorization_rule with same parameters changed the relay connection string.

Open yuyue9284 opened this issue 2 years ago • 7 comments

  • Package Name: azure-mgmt-relay
  • Package Version: 0.1.0
  • Operating System: linux
  • Python Version: Python 3.10.4

Describe the bug We use the following script to manage relay, and with the same parameter, we sometimes found that the relay connection string go changed.

          # create authorization rule
          auth_rule_rights = [azure.mgmt.relay.models.AccessRights.manage,
                              azure.mgmt.relay.models.AccessRights.send, azure.mgmt.relay.models.AccessRights.listen]
          relay_client.hybrid_connections.create_or_update_authorization_rule(
              resource_group_name, relay_namespace_name, hybrid_connection_name, auth_rule_name, rights=auth_rule_rights)

To Reproduce Steps to reproduce the behavior: We are not able to reproduce it but noticed few incidents caused by this in production.

Expected behavior A clear and concise description of what you expected to happen.

With the same parameter and an already existed relay, the connection string should never be changed.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

yuyue9284 avatar Jul 06 '22 03:07 yuyue9284

Label prediction was below confidence level 0.6 for Model:ServiceLabels: 'Authorization:0.13027541,Monitor - ApplicationInsights:0.081350416,Service Bus:0.067038566'

azure-sdk avatar Jul 06 '22 03:07 azure-sdk

Hi @yuyue9284, thank you for opening an issue! I'll tag the appropriate folks so we can look into this as soon as possible.

mccoyp avatar Jul 06 '22 17:07 mccoyp

Thank you for your feedback. This has been routed to the support team for assistance.

ghost avatar Jul 06 '22 17:07 ghost

Hi @yuyue9284, thank you for your feedback.

Please provide your detailed code to better solve your problem.

Wzb123456789 avatar Jul 08 '22 09:07 Wzb123456789

Hi @yuyue9284, thank you for your feedback.

Please provide your detailed code to better solve your problem.

Hi @Wzb123456789, this is how we used it in our application.

        # create namespace
        relay_namespace_params = azure.mgmt.relay.models.RelayNamespace(
            location=cluster_location, tags=resource_tag)
        async_poller = relay_client.namespaces.create_or_update(
            resource_group_name, relay_namespace_name, relay_namespace_params)
        while True:
            async_poller.result(15)
            if async_poller.done():
                break
        # create hybrid connection
        hybrid_connection_object = relay_client.hybrid_connections.create_or_update(
            resource_group_name, relay_namespace_name, hybrid_connection_name, requires_client_authorization=True)
        hc_resource_id = hybrid_connection_object.id
        # create authorization rule
        auth_rule_rights = [azure.mgmt.relay.models.AccessRights.manage,
                            azure.mgmt.relay.models.AccessRights.send, azure.mgmt.relay.models.AccessRights.listen]
        relay_client.hybrid_connections.create_or_update_authorization_rule(
            resource_group_name, relay_namespace_name, hybrid_connection_name, auth_rule_name, rights=auth_rule_rights)

yuyue9284 avatar Jul 11 '22 04:07 yuyue9284

Hi @yuyue9284, thank you for your response.

According to my investigation, the cause of this problem may be due to the azure-mgmt-relay version you are using is 0.1.0, azure-mgmt-relay has been updated to 1.1.0, please try to use the latest version. https://pypi.org/project/azure-mgmt-relay/#history

Wzb123456789 avatar Jul 14 '22 02:07 Wzb123456789

Hi @yuyue9284. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve” to remove the “issue-addressed” label and continue the conversation.

ghost avatar Aug 11 '22 08:08 ghost

Hi @yuyue9284, since you haven’t asked that we “/unresolve” the issue, we’ll close this out. If you believe further discussion is needed, please add a comment “/unresolve” to reopen the issue.

ghost avatar Aug 18 '22 10:08 ghost