Breaking news from around the world
Get the Bing + MSN extension
Now Available in Community - MBAS 2019 Presentation Videos
Catch the most popular sessions on demand and learn how Dynamics 365, Power BI, PowerApps, Microsoft Flow, and Excel are powering major transformations around the globe. | View Gallery
2019 release wave 2 Discover the latest updates to Dynamics 365Release overview guides and videos Release Plan | Early Access Availability
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Talent TechTalks | Upcoming TechTalks
In my last post in this series, I outlined an approach for building a simple service relay with RabbitMQ and Python to easily expose an on-premises Dynamics 365 Customer Engagement organization to external consumers. In this post I will walk through the prerequisites for building this out. I'm assuming you have access to a Dynamics 365 CE organization, so I'm going to skip the setup for that and focus on just RabbitMQ and Python today.
Back in 2015 When I first blogged about RabbitMQ and Dynamics 365, I wrote a detailed post showing how to install and configure RabbitMQ. Since then I have discovered the joys of Docker, which makes the process significantly easier. If you have access to Docker, I highly recommend using it. Once you have Docker running, you can use one of the official RabbitMQ images. For this project, I initially used the rabbitmq:3-management image in Docker for Windows running on my local PC. After I got the basic functionality working, I then moved to an instance of Docker running in the cloud on a Digital Ocean VPS.
If don't want to use Docker, you can use a full RabbitMQ install like I showed previously. The main thing to remember is that no matter how you set up your RabbitMQ server, if it is not accessible from the public internet, you will not be able to use it as a service relay between an on-premises Dynamics 365 org and external consumers.
I'm assuming if you've gotten this far, you have a functional Python development environment (if not, give Visual Studio Code a try), and the code I have written works in Python versions 2.7 or 3.x. In order to connect to both RabbitMQ and Dynamics 365, you will need a few additional packages. To connect to RabbitMQ, Pika is the RabbitMQ team's recommended Python client, and you can get it using pip.
To communicate with Dynamics 365, you'll need to use the Web API, but authentication will be handled differently depending on whether you connect to an on-premises org or an online / IFD org. For online or IFD orgs, you can either use ADAL or this alternate approach I described back in 2016. If you have an on-premises org, you can authenticate using the requests_ntlm package like I showed here. As with the Pika client, all the packages you need to connect to Dynamics 365 are also available via pip.
That's it for today. In my next post in this series I will show the Python code you need to make this service relay work.
Business Applications communities