Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.64k stars 2.84k forks source link

[Service Bus] Emulator connection string support #34273

Open jsquire opened 9 months ago

jsquire commented 9 months ago

Summary

The Azure Messaging team is working on a service emulator intended to provide a local development experience. To reduce friction for developers, the emulator will be using connections without TLS so that certificates do not need to be managed. To support this flow, the emulator will emit a connection string that contains an identifying slug to indicate to clients that they should not use TLS and should restrict communication to the local environment.

Emulator connection string slug:

;UseDevelopmentEmulator=true

Full example:

Endpoint=localhost:6765;SharedAccessKeyName=<< REDACTED >>;SharedAccessKey=<< REDACTED >>;UseDevelopmentEmulator=true

Scope of work

Out of scope

Success Criteria

References and related

jsquire commented 9 months ago

//cc: @kashifkhan, @l0lawrence, @swathipil

ColinBe95 commented 1 week ago

Hey @jsquire, do you know if there is any updates to this? The service bus emulator is now publicly available, but without connection string support it remains unusable for python developers unfortunately. Would love to use it :) Thank you so much!

jsquire commented 1 week ago

@kashifkhan, @swathipil, @l0lawrence: Has this been completed or is there still work pending?

kashifkhan commented 1 week ago

There is still work pending on it, but as soon as we have it out Ill update this thread.

jvanegmond commented 5 days ago

For anyone as incredibly curious and eager as I have been, you can already get it working with latest commits on this repo. Alternatively, you can take the currently released version and disable TLS with a workaround:

from azure.servicebus._pyamqp import AMQPClient
# Disable TLS. Workaround for https://github.com/Azure/azure-sdk-for-python/issues/34273
org_init = AMQPClient.__init__
def new_init(self, hostname, **kwargs):
    kwargs["use_tls"] = False
    org_init(self, hostname, **kwargs)
AMQPClient.__init__ = new_init